mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #23620 -- Used more specific assertions in the Django test suite.
This commit is contained in:
committed by
Tim Graham
parent
c0c78f1b70
commit
f7969b0920
@@ -190,12 +190,12 @@ class AdminScriptTestCase(unittest.TestCase):
|
||||
self.assertIsNotNone(re.search(msg, stream),
|
||||
"'%s' does not match actual output text '%s'" % (msg, stream))
|
||||
else:
|
||||
self.assertTrue(msg in stream, "'%s' does not match actual output text '%s'" % (msg, stream))
|
||||
self.assertIn(msg, stream, "'%s' does not match actual output text '%s'" % (msg, stream))
|
||||
|
||||
def assertNotInOutput(self, stream, msg):
|
||||
"Utility assertion: assert that the given message doesn't exist in the output"
|
||||
stream = force_text(stream)
|
||||
self.assertFalse(msg in stream, "'%s' matches actual output text '%s'" % (msg, stream))
|
||||
self.assertNotIn(msg, stream, "'%s' matches actual output text '%s'" % (msg, stream))
|
||||
|
||||
##########################################################################
|
||||
# DJANGO ADMIN TESTS
|
||||
@@ -904,7 +904,7 @@ class ManageAlternateSettings(AdminScriptTestCase):
|
||||
out, err = self.run_manage(args)
|
||||
expected = ('create table %s'
|
||||
% connection.ops.quote_name('admin_scripts_article'))
|
||||
self.assertTrue(expected.lower() in out.lower())
|
||||
self.assertIn(expected.lower(), out.lower())
|
||||
self.assertNoOutput(err)
|
||||
|
||||
def test_builtin_with_environment(self):
|
||||
@@ -913,7 +913,7 @@ class ManageAlternateSettings(AdminScriptTestCase):
|
||||
out, err = self.run_manage(args, 'alternate_settings')
|
||||
expected = ('create table %s'
|
||||
% connection.ops.quote_name('admin_scripts_article'))
|
||||
self.assertTrue(expected.lower() in out.lower())
|
||||
self.assertIn(expected.lower(), out.lower())
|
||||
self.assertNoOutput(err)
|
||||
|
||||
def test_builtin_with_bad_settings(self):
|
||||
|
||||
Reference in New Issue
Block a user