summaryrefslogtreecommitdiff
path: root/tests/migrations
diff options
context:
space:
mode:
authorNick Pope <nick.pope@flightdataservices.com>2019-10-21 09:55:05 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-29 12:37:30 +0100
commit7552de7866dcd270a0f353b007b4aceaa7f3ff3e (patch)
tree2e84292833853d9659671ed304cb32d5acef5f90 /tests/migrations
parenta6cb8ec3895a72bfb7f8e62d4b05dd5de6b738af (diff)
Used more specific unittest assertions in tests.
* assertIsNone()/assertIsNotNone() instead of comparing to None. * assertLess() for < comparisons. * assertIs() for 'is' expressions. * assertIsInstance() for isinstance() expressions. * rounding of assertAlmostEqual() for round() expressions. * assertIs(..., True/False) instead of comparing to True/False. * assertIs()/assertIsNot() for ==/!= comparisons. * assertNotEqual() for == comparisons. * assertTrue()/assertFalse() instead of comparing to True/False.
Diffstat (limited to 'tests/migrations')
-rw-r--r--tests/migrations/test_base.py4
-rw-r--r--tests/migrations/test_state.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/tests/migrations/test_base.py b/tests/migrations/test_base.py
index 94ff6ff0c9..45c5472b0f 100644
--- a/tests/migrations/test_base.py
+++ b/tests/migrations/test_base.py
@@ -50,10 +50,10 @@ class MigrationTestBase(TransactionTestCase):
return [c.null_ok for c in self.get_table_description(table, using=using) if c.name == column][0]
def assertColumnNull(self, table, column, using='default'):
- self.assertEqual(self._get_column_allows_null(table, column, using), True)
+ self.assertTrue(self._get_column_allows_null(table, column, using))
def assertColumnNotNull(self, table, column, using='default'):
- self.assertEqual(self._get_column_allows_null(table, column, using), False)
+ self.assertFalse(self._get_column_allows_null(table, column, using))
def assertIndexExists(self, table, columns, value=True, using='default', index_type=None):
with connections[using].cursor() as cursor:
diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py
index 0f0f918597..e9bdac93c5 100644
--- a/tests/migrations/test_state.py
+++ b/tests/migrations/test_state.py
@@ -1052,7 +1052,7 @@ class ModelStateTests(SimpleTestCase):
['searchablelocation_ptr', 'name', 'bus_routes', 'inbound']
)
self.assertEqual(station_state.fields[1][1].max_length, 128)
- self.assertEqual(station_state.fields[2][1].null, False)
+ self.assertIs(station_state.fields[2][1].null, False)
self.assertEqual(
station_state.options,
{'abstract': False, 'swappable': 'TEST_SWAPPABLE_MODEL', 'indexes': [], 'constraints': []}