Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def check_completions():
# Patch readline to return expected results for "!a_va".
monkeypatch_readline("!a_va", 0, 5)
assert pdbpp.local.GLOBAL_PDB.complete("a_va", 0) == "a_var"
# Patch readline to return expected results for "list(a_va".
monkeypatch_readline("list(a_va", 5, 9)
assert pdbpp.local.GLOBAL_PDB.complete("a_va", 0) == "a_var"
return True
def check_completions():
# Patch readline to return expected results for "wher".
monkeypatch_readline("wher", 0, 4)
assert get_completions("wher") == ["where"]
if sys.version_info > (3, ):
# Patch readline to return expected results for "disable ".
monkeypatch_readline("disable", 8, 8)
# NOTE: number depends on bpb.Breakpoint class state, just ensure that
# is a number.
completion = pdbpp.local.GLOBAL_PDB.complete("", 0)
assert int(completion) > 0
# Patch readline to return expected results for "p ".
monkeypatch_readline("p ", 2, 2)
comps = get_completions("")
assert "where" in comps
# Dunder members get completed only on second invocation.
assert "__name__" not in comps
comps = get_completions("")
assert "__name__" in comps
# Patch readline to return expected results for "help ".
monkeypatch_readline("help ", 5, 5)
comps = get_completions("")
assert "help" in comps