Commit 4c094e5f authored by Serhiy Storchaka's avatar Serhiy Storchaka

Fixed pydoc tests when run with -OO.

parent efdc16f9
...@@ -478,6 +478,8 @@ class PydocDocTest(unittest.TestCase): ...@@ -478,6 +478,8 @@ class PydocDocTest(unittest.TestCase):
self.assertEqual(expected, result, self.assertEqual(expected, result,
"documentation for missing module found") "documentation for missing module found")
@unittest.skipIf(sys.flags.optimize >= 2,
'Docstrings are omitted with -OO and above')
def test_not_ascii(self): def test_not_ascii(self):
result = run_pydoc('test.test_pydoc.nonascii', PYTHONIOENCODING='ascii') result = run_pydoc('test.test_pydoc.nonascii', PYTHONIOENCODING='ascii')
encoded = nonascii.__doc__.encode('ascii', 'backslashreplace') encoded = nonascii.__doc__.encode('ascii', 'backslashreplace')
...@@ -562,6 +564,8 @@ class PydocDocTest(unittest.TestCase): ...@@ -562,6 +564,8 @@ class PydocDocTest(unittest.TestCase):
synopsis = pydoc.synopsis(TESTFN, {}) synopsis = pydoc.synopsis(TESTFN, {})
self.assertEqual(synopsis, 'line 1: h\xe9') self.assertEqual(synopsis, 'line 1: h\xe9')
@unittest.skipIf(sys.flags.optimize >= 2,
'Docstrings are omitted with -OO and above')
def test_synopsis_sourceless(self): def test_synopsis_sourceless(self):
expected = os.__doc__.splitlines()[0] expected = os.__doc__.splitlines()[0]
filename = os.__cached__ filename = os.__cached__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment