Ticket #27914: 0002-Fixed-WriterTests.test_deconstruct_class_arguments-t.patch

File 0002-Fixed-WriterTests.test_deconstruct_class_arguments-t.patch, 1.5 KB (added by John Bowen, 5 years ago)
  • tests/migrations/test_writer.py

    From 4e6a1f49831e6326e3f0211343cddef4624d6871 Mon Sep 17 00:00:00 2001
    From: John Bowen <jbowen7@gmail.com>
    Date: Fri, 22 Nov 2019 19:41:56 +0000
    Subject: [PATCH] Fixed WriterTests.test_deconstruct_class_arguments to assert
     against a proper import path. A prior commit exposed that it was enforcing
     bad design.
    
    ---
     tests/migrations/test_writer.py | 9 +++++----
     1 file changed, 5 insertions(+), 4 deletions(-)
    
    diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
    index 99c9cbf..d082da1 100644
    a b class IntEnum(enum.IntEnum):  
    6161    B = 2
    6262
    6363
     64class DeconstructibleInstances:
     65    def deconstruct(self):
     66        return ('DeconstructibleInstances', [], {})
     67
     68
    6469class OperationWriterTests(SimpleTestCase):
    6570
    6671    def test_empty_signature(self):
    class WriterTests(SimpleTestCase):  
    733738        # Yes, it doesn't make sense to use a class as a default for a
    734739        # CharField. It does make sense for custom fields though, for example
    735740        # an enumfield that takes the enum class as an argument.
    736         class DeconstructibleInstances:
    737             def deconstruct(self):
    738                 return ('DeconstructibleInstances', [], {})
    739 
    740741        string = MigrationWriter.serialize(models.CharField(default=DeconstructibleInstances))[0]
    741742        self.assertEqual(string, "models.CharField(default=migrations.test_writer.DeconstructibleInstances)")
    742743
Back to Top