(self)
| 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( |
nothing calls this directly
no test coverage detected