MCPcopy Create free account
hub / github.com/PyCQA/flake8 / test_undefined_local_code

Function test_undefined_local_code

tests/unit/test_pyflakes_codes.py:31–45  ·  view source on GitHub ↗

In pyflakes 2.1.0 this code's string formatting was changed.

()

Source from the content-addressed store, hash-verified

29
30
31def test_undefined_local_code():
32 """In pyflakes 2.1.0 this code's string formatting was changed."""
33 src = """\
34import sys
35
36def f():
37 sys = sys
38"""
39 tree = ast.parse(src)
40 checker = pyflakes_shim.FlakesChecker(tree, "t.py")
41 message_texts = [s for _, _, s, _ in checker.run()]
42 assert message_texts == [
43 "F823 local variable 'sys' defined in enclosing scope on line 1 referenced before assignment", # noqa: E501
44 "F841 local variable 'sys' is assigned to but never used",
45 ]

Callers

nothing calls this directly

Calls 1

runMethod · 0.95

Tested by

no test coverage detected