diff options
Diffstat (limited to 'tests/bulk_create/tests.py')
| -rw-r--r-- | tests/bulk_create/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/bulk_create/tests.py b/tests/bulk_create/tests.py index a7eb725f55..e6d85cb815 100644 --- a/tests/bulk_create/tests.py +++ b/tests/bulk_create/tests.py @@ -217,3 +217,13 @@ class BulkCreateTests(TestCase): self.assertEqual(Country.objects.get(pk=countries[1].pk), countries[1]) self.assertEqual(Country.objects.get(pk=countries[2].pk), countries[2]) self.assertEqual(Country.objects.get(pk=countries[3].pk), countries[3]) + + @skipUnlessDBFeature('can_return_ids_from_bulk_insert') + def test_set_state(self): + country_nl = Country(name='Netherlands', iso_two_letter='NL') + country_be = Country(name='Belgium', iso_two_letter='BE') + Country.objects.bulk_create([country_nl]) + country_be.save() + # Objects save via bulk_create() and save() should have equal state. + self.assertEqual(country_nl._state.adding, country_be._state.adding) + self.assertEqual(country_nl._state.db, country_be._state.db) |
