From e8252fc4451ee2c05779b28e74417174f0a2eeef Mon Sep 17 00:00:00 2001 From: Nicolò Intrieri <81313286+n-borges@users.noreply.github.com> Date: Tue, 18 Jul 2023 05:27:40 +0200 Subject: Fixed #34716 -- Fixed serialization of nested class methods in migrations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Nicolò --- tests/migrations/test_writer.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py index bef8f64061..5ee814d2af 100644 --- a/tests/migrations/test_writer.py +++ b/tests/migrations/test_writer.py @@ -211,6 +211,10 @@ class WriterTests(SimpleTestCase): X = "X", "X value" Y = "Y", "Y value" + @classmethod + def method(cls): + return cls.X + def safe_exec(self, string, value=None): d = {} try: @@ -468,6 +472,15 @@ class WriterTests(SimpleTestCase): ), ) + def test_serialize_nested_class_method(self): + self.assertSerializedResultEqual( + self.NestedChoices.method, + ( + "migrations.test_writer.WriterTests.NestedChoices.method", + {"import migrations.test_writer"}, + ), + ) + def test_serialize_uuid(self): self.assertSerializedEqual(uuid.uuid1()) self.assertSerializedEqual(uuid.uuid4()) -- cgit v1.3