Refs #27914 -- Moved test enum.Enum subclasses outside of WriterTests.test_serialize_enums().
This commit is contained in:
parent
103a6f4307
commit
d3030deaaa
|
@ -41,6 +41,26 @@ class TestModel1:
|
||||||
thing = models.FileField(upload_to=upload_to)
|
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):
|
class OperationWriterTests(SimpleTestCase):
|
||||||
|
|
||||||
def test_empty_signature(self):
|
def test_empty_signature(self):
|
||||||
|
@ -253,22 +273,6 @@ class WriterTests(SimpleTestCase):
|
||||||
self.assertEqual(self.serialize_round_trip(lazy_pattern), pattern)
|
self.assertEqual(self.serialize_round_trip(lazy_pattern), pattern)
|
||||||
|
|
||||||
def test_serialize_enums(self):
|
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(
|
self.assertSerializedResultEqual(
|
||||||
TextEnum.A,
|
TextEnum.A,
|
||||||
("migrations.test_writer.TextEnum['A']", {'import migrations.test_writer'})
|
("migrations.test_writer.TextEnum['A']", {'import migrations.test_writer'})
|
||||||
|
|
Loading…
Reference in New Issue