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

Method test_update_groups

ar_test.py:33–74  ·  view source on GitHub ↗

Test for update_groups.

(self)

Source from the content-addressed store, hash-verified

31 cls.rules = pr.Theorem.from_txt_file('rules.txt', to_dict=True)
32
33 def test_update_groups(self):
34 """Test for update_groups."""
35 groups1 = [{1, 2}, {3, 4, 5}, {6, 7}]
36 groups2 = [{2, 3, 8}, {9, 10, 11}]
37
38 _, links, history = ar.update_groups(groups1, groups2)
39 self.assertEqual(
40 history,
41 [
42 [{1, 2, 3, 4, 5, 8}, {6, 7}],
43 [{1, 2, 3, 4, 5, 8}, {6, 7}, {9, 10, 11}],
44 ],
45 )
46 self.assertEqual(links, [(2, 3), (3, 8), (9, 10), (10, 11)])
47
48 groups1 = [{1, 2}, {3, 4}, {5, 6}, {7, 8}]
49 groups2 = [{2, 3, 8, 9, 10}, {3, 6, 11}]
50
51 _, links, history = ar.update_groups(groups1, groups2)
52 self.assertEqual(
53 history,
54 [
55 [{1, 2, 3, 4, 7, 8, 9, 10}, {5, 6}],
56 [{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}],
57 ],
58 )
59 self.assertEqual(links, [(2, 3), (3, 8), (8, 9), (9, 10), (3, 6), (6, 11)])
60
61 groups1 = []
62 groups2 = [{1, 2}, {3, 4}, {5, 6}, {2, 3}]
63
64 _, links, history = ar.update_groups(groups1, groups2)
65 self.assertEqual(
66 history,
67 [
68 [{1, 2}],
69 [{1, 2}, {3, 4}],
70 [{1, 2}, {3, 4}, {5, 6}],
71 [{1, 2, 3, 4}, {5, 6}],
72 ],
73 )
74 self.assertEqual(links, [(1, 2), (3, 4), (5, 6), (2, 3)])
75
76 def test_generic_table_simple(self):
77 tb = ar.Table()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected