You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assertRaisesRegexp was renamed to assertRaisesRregex in Python 3.2, and is going away in 3.12. Unfortunately merely adding it to DEPRECATED_ALIASES breaks its use as a context manager
teyit will wipe out the context manager, and fail with an indentation error:
$ teyit --show-stats t.pyiteration=0import unittestclass foo(unittest.TestCase): def testBar(self): with self.assertRaisesRegexp(Exception, "message"): passcalling astparse()iteration=1import unittestclass foo(unittest.TestCase): def testBar(self): self.assertRaisesRegex(Exception, "message") passcalling astparse()Traceback (most recent call last): File "/opt/homebrew/bin/teyit", line 8, in <module> sys.exit(main()) ^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/teyit.py", line 401, in main raise SystemExit(_refactor_files(**vars(options))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/teyit.py", line 358, in _refactor_files if len(refactors := _refactor_file(path)) > 0: ^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/teyit.py", line 346, in _refactor_file refactored_source, refactors = refactor_until_deterministic( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/teyit.py", line 305, in refactor_until_deterministic source, _refactors = rewrite_source(source, blacklist=blacklist) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/teyit.py", line 273, in rewrite_source tree = ast.parse(source) ^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ast.py", line 50, in parse return compile(source, filename, mode, flags, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<unknown>", line 6 pass ^IndentationError: unindent does not match any outer indentation level
The text was updated successfully, but these errors were encountered:
assertRaisesRegexp
was renamed toassertRaisesRregex
in Python 3.2, and is going away in 3.12. Unfortunately merely adding it to DEPRECATED_ALIASES breaks its use as a context managerGiven:
and:
teyit
will wipe out the context manager, and fail with an indentation error:The text was updated successfully, but these errors were encountered: