MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / TracebackTest

Class TracebackTest

trace_back_test.py:27–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26
27class TracebackTest(unittest.TestCase):
28
29 @classmethod
30 def setUpClass(cls):
31 super().setUpClass()
32 cls.defs = pr.Definition.from_txt_file('defs.txt', to_dict=True)
33 cls.rules = pr.Theorem.from_txt_file('rules.txt', to_dict=True)
34
35 def test_orthocenter_dependency_difference(self):
36 txt = 'a b c = triangle a b c; d = on_tline d b a c, on_tline d c a b; e = on_line e a c, on_line e b d ? perp a d b c' # pylint: disable=line-too-long
37 p = pr.Problem.from_txt(txt)
38 g, _ = gh.Graph.build_problem(p, TracebackTest.defs)
39
40 ddar.solve(g, TracebackTest.rules, p)
41
42 goal_args = g.names2nodes(p.goal.args)
43 query = pr.Dependency(p.goal.name, goal_args, None, None)
44
45 setup, aux, _, _ = tb.get_logs(query, g, merge_trivials=False)
46
47 # Convert each predicates to its hash string:
48 setup = [p.hashed() for p in setup]
49 aux = [p.hashed() for p in aux]
50
51 self.assertCountEqual(
52 setup, [('perp', 'a', 'c', 'b', 'd'), ('perp', 'a', 'b', 'c', 'd')]
53 )
54
55 self.assertCountEqual(
56 aux, [('coll', 'a', 'c', 'e'), ('coll', 'b', 'd', 'e')]
57 )
58
59
60if __name__ == '__main__':

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected