def testsplitabove(self): T = SNT(4, 1, 1, 2) T.setroot(Point([0], Euclidean())) a = T.splitbelow(T.root, 10) b = T.splitbelow(a, 0) n = T.splitabove(b, 5) self.assertEqual(n.level, 5) self.assertEqual(n.ch, {b}) self.assertEqual(n.par, a) self.assertEqual(b.par, n) self.assertEqual(a.ch, {n})
def testsplitbelow_leaf(self): T = SNT(3, 1, 1) T.setroot(Point([0], Euclidean())) a = T.splitbelow(T.root, 10) n = T.splitbelow(a, 0) self.assertEqual(n.point, a.point) self.assertEqual(n.level, 0) self.assertEqual(n.par, a) self.assertEqual(a.ch, {n}) self.assertTrue(n in a.ch) self.assertTrue(n not in T.root.ch) self.assertEqual(n.getchild().level, float('-inf')) self.assertEqual(n.rel, {n})
def testsplitbelow_root(self): T = SNT(3, 1, 1) T.setroot(Point([0], Euclidean())) n = T.splitbelow(T.root, 1) self.assertEqual(n.point, T.root.point) self.assertEqual(n.level, 1) self.assertEqual(n.par, T.root) self.assertEqual(T.root.ch, {n}) self.assertTrue(n in T.root.ch) self.assertEqual(n.getchild().level, float('-inf')) self.assertEqual(n.rel, {n})