MCPcopy Create free account
hub / github.com/ipython/ipython / test_extract_symbols

Function test_extract_symbols

IPython/core/tests/test_magic.py:56–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54 nt.assert_equal(actual, expected)
55
56def test_extract_symbols():
57 source = """import foo\na = 10\ndef b():\n return 42\n\n\nclass A: pass\n\n\n"""
58 symbols_args = ["a", "b", "A", "A,b", "A,a", "z"]
59 expected = [([], ['a']),
60 (["def b():\n return 42\n"], []),
61 (["class A: pass\n"], []),
62 (["class A: pass\n", "def b():\n return 42\n"], []),
63 (["class A: pass\n"], ['a']),
64 ([], ['z'])]
65 for symbols, exp in zip(symbols_args, expected):
66 nt.assert_equal(code.extract_symbols(source, symbols), exp)
67
68
69def test_extract_symbols_raises_exception_with_non_python_code():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected