diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py index 2aa1765125..c0fe308a07 100644 --- a/tests/annotations/tests.py +++ b/tests/annotations/tests.py @@ -241,7 +241,7 @@ class NonAggregateAnnotationTestCase(TestCase): ), rating_count=Count('rating'), ).first() - self.assertEqual(book.isnull_pubdate, False) + self.assertIs(book.isnull_pubdate, False) self.assertEqual(book.rating_count, 1) @skipUnlessDBFeature('supports_boolean_expr_in_select_clause') diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py index 76b0eb7f3c..e208305fc6 100644 --- a/tests/auth_tests/test_forms.py +++ b/tests/auth_tests/test_forms.py @@ -1035,7 +1035,7 @@ class ReadOnlyPasswordHashTest(SimpleTestCase): hash_field = ReadOnlyPasswordHashField() 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(), '') diff --git a/tests/backends/tests.py b/tests/backends/tests.py index 1536e93065..2291a76c75 100644 --- a/tests/backends/tests.py +++ b/tests/backends/tests.py @@ -501,7 +501,7 @@ class BackendTestCase(TransactionTestCase): params, kwargs = mocked_logger.debug.call_args self.assertIn('; alias=%s', params[0]) self.assertEqual(params[2], sql) - self.assertEqual(params[3], None) + self.assertIsNone(params[3]) self.assertEqual(params[4], connection.alias) self.assertEqual( list(kwargs['extra']), diff --git a/tests/model_inheritance/test_abstract_inheritance.py b/tests/model_inheritance/test_abstract_inheritance.py index f2dab05b8b..a78111b5e3 100644 --- a/tests/model_inheritance/test_abstract_inheritance.py +++ b/tests/model_inheritance/test_abstract_inheritance.py @@ -57,7 +57,7 @@ class AbstractInheritanceTests(SimpleTestCase): self.assertEqual(Child.check(), []) 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) def test_diamond_shaped_multiple_inheritance_is_depth_first(self): @@ -93,7 +93,7 @@ class AbstractInheritanceTests(SimpleTestCase): self.assertEqual(Child.check(), []) 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) def test_target_field_may_be_pushed_down(self): @@ -124,7 +124,7 @@ class AbstractInheritanceTests(SimpleTestCase): self.assertEqual(Child.check(), []) 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): class ConcreteParent(models.Model): diff --git a/tests/test_runner/test_discover_runner.py b/tests/test_runner/test_discover_runner.py index 9fb6d9f09d..4f7aed059f 100644 --- a/tests/test_runner/test_discover_runner.py +++ b/tests/test_runner/test_discover_runner.py @@ -405,7 +405,7 @@ class DiscoverRunnerTests(SimpleTestCase): with runner.time_keeper.timed('test'): pass runner.time_keeper.print_results() - self.assertTrue(isinstance(runner.time_keeper, NullTimeKeeper)) + self.assertIsInstance(runner.time_keeper, NullTimeKeeper) self.assertNotIn('test', stderr.getvalue()) def test_timings_captured(self): @@ -414,7 +414,7 @@ class DiscoverRunnerTests(SimpleTestCase): with runner.time_keeper.timed('test'): pass runner.time_keeper.print_results() - self.assertTrue(isinstance(runner.time_keeper, TimeKeeper)) + self.assertIsInstance(runner.time_keeper, TimeKeeper) self.assertIn('test', stderr.getvalue()) def test_log(self):