Skip to content

Test test_inspect fails with -OO #116780

Description

@sobolevn

Bug report

======================================================================
FAIL: test_class_inside_conditional (test.test_inspect.test_inspect.TestBuggyCases.test_class_inside_conditional)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_inspect/test_inspect.py", line 995, in test_class_inside_conditional
    self.assertSourceEqual(mod2.cls238.cls239, 239, 240)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_inspect/test_inspect.py", line 550, in assertSourceEqual
    self.assertEqual(inspect.getsource(obj),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
                     self.sourcerange(top, bottom))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: "        class cls239:\n            '''else clause 239'''\n            pass\n" != "        class cls239:\n            '''if clause cls239'''\n"
          class cls239:
-             '''else clause 239'''
?                ^^^^
+             '''if clause cls239'''
?                ^^        +++
-             pass


======================================================================
FAIL: test_base_class_have_text_signature (test.test_inspect.test_inspect.TestSignatureDefinitions.test_base_class_have_text_signature)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_inspect/test_inspect.py", line 5315, in test_base_class_have_text_signature
    self.assertEqual(text_signature, '(raw, buffer_size=DEFAULT_BUFFER_SIZE)')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != '(raw, buffer_size=DEFAULT_BUFFER_SIZE)'

----------------------------------------------------------------------
Ran 297 tests in 0.536s

I will send a PR.

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions