[Python-checkins] r78407 - sandbox/trunk/2to3/lib2to3/tests/test_refactor.py

benjamin.peterson python-checkins at python.org
Wed Feb 24 03:21:34 CET 2010


Author: benjamin.peterson
Date: Wed Feb 24 03:21:34 2010
New Revision: 78407
Log:
rewrite test to not rely on __doc__ being present
Modified:
 sandbox/trunk/2to3/lib2to3/tests/test_refactor.py
Modified: sandbox/trunk/2to3/lib2to3/tests/test_refactor.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/tests/test_refactor.py	(original)
+++ sandbox/trunk/2to3/lib2to3/tests/test_refactor.py	Wed Feb 24 03:21:34 2010
@@ -242,21 +242,19 @@
 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


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /