diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2015-03-26 09:49:13 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-04-15 08:19:25 -0400 |
| commit | 97bb48d9ba864060d57a3137fb9c456b98ecc79b (patch) | |
| tree | 8ccc820938e75490ba89d75e7c8db4d6e20e52a2 | |
| parent | 28e89783254ac0899a26eee324555a9033ccbe9a (diff) | |
Fixed model_fields tests to use django TestCase.
| -rw-r--r-- | tests/model_fields/tests.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index 6b63b8f115..46779626f8 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -245,7 +245,7 @@ class ManyToManyFieldTests(test.TestCase): ) -class DateTimeFieldTests(unittest.TestCase): +class DateTimeFieldTests(test.TestCase): def test_datetimefield_to_python_usecs(self): """DateTimeField.to_python should support usecs""" f = models.DateTimeField() @@ -275,7 +275,7 @@ class DateTimeFieldTests(unittest.TestCase): self.assertEqual(obj.t, tim) -class BooleanFieldTests(unittest.TestCase): +class BooleanFieldTests(test.TestCase): def _test_get_db_prep_lookup(self, f): self.assertEqual(f.get_db_prep_lookup('exact', True, connection=connection), [True]) self.assertEqual(f.get_db_prep_lookup('exact', '1', connection=connection), [True]) @@ -414,8 +414,9 @@ class BooleanFieldTests(unittest.TestCase): self.assertFalse(boolean_field.has_default()) b = BooleanModel() self.assertIsNone(b.bfield) - with self.assertRaises(IntegrityError): - b.save() + with transaction.atomic(): + with self.assertRaises(IntegrityError): + b.save() finally: boolean_field.default = old_default |
