diff options
| author | Loic Bistuer <loic.bistuer@gmail.com> | 2014-09-23 23:29:17 +0700 |
|---|---|---|
| committer | Loic Bistuer <loic.bistuer@gmail.com> | 2014-09-24 02:03:12 +0700 |
| commit | 1fd6e13bf2db025dc93482184439cc1a900db276 (patch) | |
| tree | 06bfcb423a572a081df7b9f67bff6411f5cc598b /tests/many_to_one_null/tests.py | |
| parent | 2a1bdf5ced3f22c2ff687afab45d811cfa555e74 (diff) | |
Consolidated some many_to_one tests.
Diffstat (limited to 'tests/many_to_one_null/tests.py')
| -rw-r--r-- | tests/many_to_one_null/tests.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/many_to_one_null/tests.py b/tests/many_to_one_null/tests.py index 2463065c9d..a72b821f88 100644 --- a/tests/many_to_one_null/tests.py +++ b/tests/many_to_one_null/tests.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.test import TestCase -from .models import Reporter, Article +from .models import Article, Car, Driver, Reporter class ManyToOneNullTests(TestCase): @@ -105,3 +105,10 @@ class ManyToOneNullTests(TestCase): with self.assertNumQueries(1): r.article_set.clear() self.assertEqual(r.article_set.count(), 0) + + def test_related_null_to_field(self): + c1 = Car.objects.create() + d1 = Driver.objects.create() + self.assertIs(d1.car, None) + with self.assertNumQueries(0): + self.assertEqual(list(c1.drivers.all()), []) |
