]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #25755: Move PropertyWritableDoc into the test case
authorBerker Peksag <berker.peksag@gmail.com>
Fri, 11 Dec 2015 21:48:13 +0000 (23:48 +0200)
committerBerker Peksag <berker.peksag@gmail.com>
Fri, 11 Dec 2015 21:48:13 +0000 (23:48 +0200)
This fixes a test failure in refleak mode because
test_property_decorator_doc_writable no longer modifies
the class in module level.

Initial patch by Nan Wu and Torsten Landschoff (from issue 25757)

Lib/test/test_property.py

index 5addd363ed4f4e74a2d2ef1571c3592d999b52d3..26b7d5283a2220b729b91cd237ec4a9c9d260c4f 100644 (file)
@@ -76,13 +76,6 @@ class PropertyNewGetter(object):
         """new docstring"""
         return 8
 
-class PropertyWritableDoc(object):
-
-    @property
-    def spam(self):
-        """Eggs"""
-        return "eggs"
-
 class PropertyTests(unittest.TestCase):
     def test_property_decorator_baseclass(self):
         # see #1620
@@ -168,6 +161,13 @@ class PropertyTests(unittest.TestCase):
     @unittest.skipIf(sys.flags.optimize >= 2,
                      "Docstrings are omitted with -O2 and above")
     def test_property_decorator_doc_writable(self):
+        class PropertyWritableDoc(object):
+
+            @property
+            def spam(self):
+                """Eggs"""
+                return "eggs"
+
         sub = PropertyWritableDoc()
         self.assertEqual(sub.__class__.spam.__doc__, 'Eggs')
         sub.__class__.spam.__doc__ = 'Spam'