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

Class ProblemTest

problem_test.py:23–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23class ProblemTest(unittest.TestCase):
24
25 @classmethod
26 def setUpClass(cls):
27 super().setUpClass()
28 cls.defs = pr.Definition.from_txt_file('defs.txt', to_dict=True)
29
30 def test_orthocenter_no_translate(self):
31 txt = 'a b c = triangle a b c; h = on_tline h b a c, on_tline h c a b ? perp a h b c' # pylint: disable=line-too-long
32
33 # read the txt into pr.Problem object, do not change the name of points:
34 p = pr.Problem.from_txt(txt, translate=False)
35
36 # This is fed into the LM, translating from constructive to constrained:
37 setup_str = p.setup_str_from_problem(ProblemTest.defs)
38
39 self.assertEqual(
40 setup_str,
41 '{S} a : ; b : ; c : ; h : T a b c h 00 T a c b h 01 ? T a h b c',
42 )
43
44 def test_orthocenter_translate(self):
45 txt = 'a b c = triangle a b c; h = on_tline h b a c, on_tline h c a b ? perp a h b c' # pylint: disable=line-too-long
46
47 # Read the txt into pr.Problem object, change h -> d to match
48 # training data distribution.
49 p = pr.Problem.from_txt(txt, translate=True)
50
51 # This is fed into the LM, translating from constructive to constrained:
52 setup_str = p.setup_str_from_problem(ProblemTest.defs)
53
54 self.assertEqual(
55 setup_str,
56 '{S} a : ; b : ; c : ; d : T a b c d 00 T a c b d 01 ? T a d b c',
57 )
58
59
60if __name__ == '__main__':

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected