def test_list(): f = formatting.TermFormatter(Engine(), quoted=False, ignore_ops=False) t = parse_query_term("[1, 2, 3, 4, 5 | X].") assert f.format(t) == "[1, 2, 3, 4, 5|_G0]" t = parse_query_term("[a, b, 'A$%%$$'|[]].") assert f.format(t) == "[a, b, A$%%$$]" t = parse_query_term("'.'(a, b, c).") assert f.format(t) == ".(a, b, c)" X = BindingVar() a = Callable.build('a') t = Callable.build(".", [a, X]) X.binding = Callable.build(".", [a, Callable.build("[]")]) assert f.format(t) == "[a, a]"
def test_copy_dereferences(): from prolog.interpreter.memo import CopyMemo v1 = BindingVar() v1.binding = Number(10) v2 = v1.copy(None, CopyMemo()) assert v2.num == 10