Used more specific unittest assertions in tests.
This commit is contained in:
parent
7309393c3a
commit
c51bf80d56
|
@ -241,7 +241,7 @@ class NonAggregateAnnotationTestCase(TestCase):
|
||||||
),
|
),
|
||||||
rating_count=Count('rating'),
|
rating_count=Count('rating'),
|
||||||
).first()
|
).first()
|
||||||
self.assertEqual(book.isnull_pubdate, False)
|
self.assertIs(book.isnull_pubdate, False)
|
||||||
self.assertEqual(book.rating_count, 1)
|
self.assertEqual(book.rating_count, 1)
|
||||||
|
|
||||||
@skipUnlessDBFeature('supports_boolean_expr_in_select_clause')
|
@skipUnlessDBFeature('supports_boolean_expr_in_select_clause')
|
||||||
|
|
|
@ -1035,7 +1035,7 @@ class ReadOnlyPasswordHashTest(SimpleTestCase):
|
||||||
hash_field = ReadOnlyPasswordHashField()
|
hash_field = ReadOnlyPasswordHashField()
|
||||||
|
|
||||||
bound_field = TestForm()['hash_field']
|
bound_field = TestForm()['hash_field']
|
||||||
self.assertEqual(bound_field.field.widget.id_for_label('id'), None)
|
self.assertIsNone(bound_field.field.widget.id_for_label('id'))
|
||||||
self.assertEqual(bound_field.label_tag(), '<label>Hash field:</label>')
|
self.assertEqual(bound_field.label_tag(), '<label>Hash field:</label>')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -501,7 +501,7 @@ class BackendTestCase(TransactionTestCase):
|
||||||
params, kwargs = mocked_logger.debug.call_args
|
params, kwargs = mocked_logger.debug.call_args
|
||||||
self.assertIn('; alias=%s', params[0])
|
self.assertIn('; alias=%s', params[0])
|
||||||
self.assertEqual(params[2], sql)
|
self.assertEqual(params[2], sql)
|
||||||
self.assertEqual(params[3], None)
|
self.assertIsNone(params[3])
|
||||||
self.assertEqual(params[4], connection.alias)
|
self.assertEqual(params[4], connection.alias)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list(kwargs['extra']),
|
list(kwargs['extra']),
|
||||||
|
|
|
@ -57,7 +57,7 @@ class AbstractInheritanceTests(SimpleTestCase):
|
||||||
|
|
||||||
self.assertEqual(Child.check(), [])
|
self.assertEqual(Child.check(), [])
|
||||||
inherited_field = Child._meta.get_field('name')
|
inherited_field = Child._meta.get_field('name')
|
||||||
self.assertTrue(isinstance(inherited_field, models.CharField))
|
self.assertIsInstance(inherited_field, models.CharField)
|
||||||
self.assertEqual(inherited_field.max_length, 255)
|
self.assertEqual(inherited_field.max_length, 255)
|
||||||
|
|
||||||
def test_diamond_shaped_multiple_inheritance_is_depth_first(self):
|
def test_diamond_shaped_multiple_inheritance_is_depth_first(self):
|
||||||
|
@ -93,7 +93,7 @@ class AbstractInheritanceTests(SimpleTestCase):
|
||||||
|
|
||||||
self.assertEqual(Child.check(), [])
|
self.assertEqual(Child.check(), [])
|
||||||
inherited_field = Child._meta.get_field('name')
|
inherited_field = Child._meta.get_field('name')
|
||||||
self.assertTrue(isinstance(inherited_field, models.CharField))
|
self.assertIsInstance(inherited_field, models.CharField)
|
||||||
self.assertEqual(inherited_field.max_length, 255)
|
self.assertEqual(inherited_field.max_length, 255)
|
||||||
|
|
||||||
def test_target_field_may_be_pushed_down(self):
|
def test_target_field_may_be_pushed_down(self):
|
||||||
|
@ -124,7 +124,7 @@ class AbstractInheritanceTests(SimpleTestCase):
|
||||||
|
|
||||||
self.assertEqual(Child.check(), [])
|
self.assertEqual(Child.check(), [])
|
||||||
inherited_field = Child._meta.get_field('name')
|
inherited_field = Child._meta.get_field('name')
|
||||||
self.assertTrue(isinstance(inherited_field, models.IntegerField))
|
self.assertIsInstance(inherited_field, models.IntegerField)
|
||||||
|
|
||||||
def test_multiple_inheritance_cannot_shadow_concrete_inherited_field(self):
|
def test_multiple_inheritance_cannot_shadow_concrete_inherited_field(self):
|
||||||
class ConcreteParent(models.Model):
|
class ConcreteParent(models.Model):
|
||||||
|
|
|
@ -405,7 +405,7 @@ class DiscoverRunnerTests(SimpleTestCase):
|
||||||
with runner.time_keeper.timed('test'):
|
with runner.time_keeper.timed('test'):
|
||||||
pass
|
pass
|
||||||
runner.time_keeper.print_results()
|
runner.time_keeper.print_results()
|
||||||
self.assertTrue(isinstance(runner.time_keeper, NullTimeKeeper))
|
self.assertIsInstance(runner.time_keeper, NullTimeKeeper)
|
||||||
self.assertNotIn('test', stderr.getvalue())
|
self.assertNotIn('test', stderr.getvalue())
|
||||||
|
|
||||||
def test_timings_captured(self):
|
def test_timings_captured(self):
|
||||||
|
@ -414,7 +414,7 @@ class DiscoverRunnerTests(SimpleTestCase):
|
||||||
with runner.time_keeper.timed('test'):
|
with runner.time_keeper.timed('test'):
|
||||||
pass
|
pass
|
||||||
runner.time_keeper.print_results()
|
runner.time_keeper.print_results()
|
||||||
self.assertTrue(isinstance(runner.time_keeper, TimeKeeper))
|
self.assertIsInstance(runner.time_keeper, TimeKeeper)
|
||||||
self.assertIn('test', stderr.getvalue())
|
self.assertIn('test', stderr.getvalue())
|
||||||
|
|
||||||
def test_log(self):
|
def test_log(self):
|
||||||
|
|
Loading…
Reference in New Issue