From d3030deaaa50b7814e34ef1e71f2afaf97c6bec6 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Wed, 2 Oct 2019 15:12:14 +0200 Subject: [PATCH] Refs #27914 -- Moved test enum.Enum subclasses outside of WriterTests.test_serialize_enums(). --- tests/migrations/test_writer.py | 36 ++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py index 6295a679924..7caca12b7d5 100644 --- a/tests/migrations/test_writer.py +++ b/tests/migrations/test_writer.py @@ -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'})