MCPcopy Index your code
hub / github.com/ipython/ipython / test_private_attr_completions

Method test_private_attr_completions

tests/test_completer.py:2071–2090  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2069 _(["completion_a"])
2070
2071 def test_private_attr_completions(self):
2072 ip = get_ipython()
2073 ip.user_ns["Test"] = type("Test", (), {"_test1": 1, "__test2": 2})
2074 ip.user_ns["t"] = ip.user_ns["Test"]()
2075 ip.Completer.use_jedi = False
2076
2077 try:
2078 with provisionalcompleter():
2079 completions = list(ip.Completer.completions(text="t._", offset=3))
2080 completion_texts = [c.text for c in completions]
2081
2082 assert (
2083 "._test1" in completion_texts
2084 ), f"_test1 not found in {completion_texts}"
2085 assert (
2086 ".__test2" in completion_texts
2087 ), f"__test2 not found in {completion_texts}"
2088 finally:
2089 del ip.user_ns["Test"]
2090 del ip.user_ns["t"]
2091
2092
2093@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

get_ipythonFunction · 0.90
provisionalcompleterFunction · 0.90
completionsMethod · 0.80

Tested by

no test coverage detected