Commits

Benjamin Peterson committed 8c5b845

rewrite test to not rely on __doc__ being present

  • Participants
  • Parent commits f1ae40b

Comments (0)

Files changed (1)

File lib2to3/tests/test_refactor.py

     def test_refactor_docstring(self):
         rt = self.rt()
 
-        def example():
-            """
-            >>> example()
-            42
-            """
-        out = rt.refactor_docstring(example.__doc__, "<test>")
-        self.assertEqual(out, example.__doc__)
+        doc = """
+>>> example()
+42
+"""
+        out = rt.refactor_docstring(doc, "<test>")
+        self.assertEqual(out, doc)
 
-        def parrot():
-            """
-            >>> def parrot():
-            ...      return 43
-            """
-        out = rt.refactor_docstring(parrot.__doc__, "<test>")
-        self.assertNotEqual(out, parrot.__doc__)
+        doc = """
+>>> def parrot():
+...      return 43
+"""
+        out = rt.refactor_docstring(doc, "<test>")
+        self.assertNotEqual(out, doc)
 
     def test_explicit(self):
         from myfixes.fix_explicit import FixExplicit