Exemplo n.º 1
0
 def test_unify_not_full_dims_different_dims(self):
     cs.init(3, {0: [0, 1], 1: [2]})
     c1 = Cuboid([1, 2, 3], [7, 8, 9], {0: [0, 1], 1: [2]})
     c2 = Cuboid([4, 5, float("-inf")], [7, 7, float("inf")], {0: [0, 1]})
     s1 = Core([c1], {0: [0, 1], 1: [2]})
     s2 = Core([c2], {0: [0, 1]})
     with self.assertRaises(Exception):
         s1.union_with(s2)
Exemplo n.º 2
0
 def test_unify_not_full_dims_same_dims(self):
     cs.init(3, {0: [0, 1], 1: [2]})
     c1 = Cuboid([1, 2, float("-inf")], [7, 8, float("inf")], {0: [0, 1]})
     c2 = Cuboid([4, 5, float("-inf")], [8, 7, float("inf")], {0: [0, 1]})
     s1 = Core([c1], {0: [0, 1]})
     s2 = Core([c2], {0: [0, 1]})
     s_result = Core([c1, c2], {0: [0, 1]})
     self.assertEqual(s1.union_with(s2), s_result)
     self.assertEqual(s1.union_with(s2), s2.union_with(s1))
Exemplo n.º 3
0
 def test_unify_no_repair(self):
     cs.init(3, {0: [0, 1, 2]})
     c1 = Cuboid([1, 2, 3], [7, 8, 9], {0: [0, 1, 2]})
     c2 = Cuboid([4, 5, 6], [7, 9, 7], {0: [0, 1, 2]})
     s1 = Core([c1], {0: [0, 1, 2]})
     s2 = Core([c2], {0: [0, 1, 2]})
     s_result = Core([c1, c2], {0: [0, 1, 2]})
     self.assertEqual(s1.union_with(s2), s_result)
     self.assertEqual(s1.union_with(s2), s2.union_with(s1))
Exemplo n.º 4
0
 def test_unify_repair(self):
     cs.init(3, {0: [0, 1, 2]})
     c1 = Cuboid([1, 2, 3], [2, 3, 4], {0: [0, 1, 2]})
     c2 = Cuboid([3, 4, 5], [7, 7, 7], {0: [0, 1, 2]})
     s1 = Core([c1], {0: [0, 1, 2]})
     s2 = Core([c2], {0: [0, 1, 2]})
     c1_result = Cuboid([1, 2, 3], [3.25, 4, 4.75], {0: [0, 1, 2]})
     c2_result = Cuboid([3, 4, 4.75], [7, 7, 7], {0: [0, 1, 2]})
     s_result = Core([c1_result, c2_result], {0: [0, 1, 2]})
     self.assertEqual(s1.union_with(s2), s_result)
     self.assertEqual(s1.union_with(s2), s2.union_with(s1))
Exemplo n.º 5
0
 def test_unify_no_core(self):
     cs.init(3, {0: [0, 1, 2]})
     c = Cuboid([1, 2, 3], [7, 8, 9], {0: [0, 1, 2]})
     s = Core([c], {0: [0, 1, 2]})
     with self.assertRaises(Exception):
         s.union_with(42)