[1.8.x] Fixed model_fields tests to use django TestCase.
Backport of 97bb48d9ba
from master
This commit is contained in:
parent
a988cc8f18
commit
c38d8f0f87
|
@ -202,7 +202,7 @@ class ForeignKeyTests(test.TestCase):
|
||||||
self.assertIsInstance(rel_name, six.text_type)
|
self.assertIsInstance(rel_name, six.text_type)
|
||||||
|
|
||||||
|
|
||||||
class DateTimeFieldTests(unittest.TestCase):
|
class DateTimeFieldTests(test.TestCase):
|
||||||
def test_datetimefield_to_python_usecs(self):
|
def test_datetimefield_to_python_usecs(self):
|
||||||
"""DateTimeField.to_python should support usecs"""
|
"""DateTimeField.to_python should support usecs"""
|
||||||
f = models.DateTimeField()
|
f = models.DateTimeField()
|
||||||
|
@ -232,7 +232,7 @@ class DateTimeFieldTests(unittest.TestCase):
|
||||||
self.assertEqual(obj.t, tim)
|
self.assertEqual(obj.t, tim)
|
||||||
|
|
||||||
|
|
||||||
class BooleanFieldTests(unittest.TestCase):
|
class BooleanFieldTests(test.TestCase):
|
||||||
def _test_get_db_prep_lookup(self, f):
|
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', True, connection=connection), [True])
|
||||||
self.assertEqual(f.get_db_prep_lookup('exact', '1', connection=connection), [True])
|
self.assertEqual(f.get_db_prep_lookup('exact', '1', connection=connection), [True])
|
||||||
|
@ -371,8 +371,9 @@ class BooleanFieldTests(unittest.TestCase):
|
||||||
self.assertFalse(boolean_field.has_default())
|
self.assertFalse(boolean_field.has_default())
|
||||||
b = BooleanModel()
|
b = BooleanModel()
|
||||||
self.assertIsNone(b.bfield)
|
self.assertIsNone(b.bfield)
|
||||||
with self.assertRaises(IntegrityError):
|
with transaction.atomic():
|
||||||
b.save()
|
with self.assertRaises(IntegrityError):
|
||||||
|
b.save()
|
||||||
finally:
|
finally:
|
||||||
boolean_field.default = old_default
|
boolean_field.default = old_default
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue