[2.2.x] Fixed #30350 -- Prevented recreation of migration for operations with a range object.

Thanks to Mariusz Felisiak for helping with the patch.

Backport of 2e38f2015a from master.
This commit is contained in:
Florian Apolloner 2019-04-13 15:03:26 +02:00 committed by Mariusz Felisiak
parent 5ed5ce5211
commit 896cc71901
No known key found for this signature in database
GPG key ID: 2EF56372BA48CD1B
3 changed files with 10 additions and 1 deletions

View file

@ -455,6 +455,11 @@ class WriterTests(SimpleTestCase):
self.assertSerializedEqual(one_item_tuple)
self.assertSerializedEqual(many_items_tuple)
def test_serialize_range(self):
string, imports = MigrationWriter.serialize(range(1, 5))
self.assertEqual(string, 'range(1, 5)')
self.assertEqual(imports, set())
def test_serialize_builtins(self):
string, imports = MigrationWriter.serialize(range)
self.assertEqual(string, 'range')