[3.0.x] Refs #27914 -- Moved test enum.Enum subclasses outside of WriterTests.test_serialize_enums().

Backport of d3030deaaa from master
This commit is contained in:
Hasan Ramezani 2019-10-02 15:12:14 +02:00 committed by Mariusz Felisiak
parent 9fa6c737df
commit 1a4db2cc28
1 changed files with 20 additions and 16 deletions

View File

@ -41,6 +41,26 @@ class TestModel1:
thing = models.FileField(upload_to=upload_to)
class TextEnum(enum.Enum):
A = 'a-value'
B = 'value-b'
class TextTranslatedEnum(enum.Enum):
A = _('a-value')
B = _('value-b')
class BinaryEnum(enum.Enum):
A = b'a-value'
B = b'value-b'
class IntEnum(enum.IntEnum):
A = 1
B = 2
class OperationWriterTests(SimpleTestCase):
def test_empty_signature(self):
@ -253,22 +273,6 @@ class WriterTests(SimpleTestCase):
self.assertEqual(self.serialize_round_trip(lazy_pattern), pattern)
def test_serialize_enums(self):
class TextEnum(enum.Enum):
A = 'a-value'
B = 'value-b'
class TextTranslatedEnum(enum.Enum):
A = _('a-value')
B = _('value-b')
class BinaryEnum(enum.Enum):
A = b'a-value'
B = b'value-b'
class IntEnum(enum.IntEnum):
A = 1
B = 2
self.assertSerializedResultEqual(
TextEnum.A,
("migrations.test_writer.TextEnum['A']", {'import migrations.test_writer'})