Skip to content

Test test_inspect fails with -OO #116780

Closed
Closed

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

  1. added
    type-bugAn unexpected behavior, bug, or error
    testsTests in the Lib/test dir
    stdlibStandard Library Python modules in the Lib/ directory
    on Mar 14, 2024
  2. self-assigned this
    on Mar 14, 2024
  3. added 4 commits that reference this issue on Mar 14, 2024
  4. added a commit that references this issue on Mar 20, 2024
  5. added a commit that references this issue on Mar 25, 2024
  6. added a commit that references this issue on Apr 17, 2024
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