def test_split_equal_below(self): """Test splitEqualBelow""" c0 = [0, 1, 9, 10, 12, 31, 41] p0 = [ 0, 10, 20, 100, 120, 310, 410 ] f0 = Fiber(c0, p0) c1 = [1, 2, 10, 11, 13, 32, 42] p1 = [ 1, 11, 21, 101, 121, 311, 411 ] f1 = Fiber(c1, p1) c = [2, 4] f = Fiber(c, [f0, f1]) f.splitEqualBelow(4, depth=0) f0_split = f0.splitEqual(4) f1_split = f1.splitEqual(4) f_ref = Fiber(c, [f0_split, f1_split]) self.assertEqual(f, f_ref)
def test_split_equal_below_deep(self): """Test splitEqualBelow with depth=1""" c0 = [0, 1, 9, 10, 12, 31, 41] p0 = [ 0, 10, 20, 100, 120, 310, 410 ] f0 = Fiber(c0, p0) c1 = [1, 2, 10, 11, 13, 32, 42] p1 = [ 1, 11, 21, 101, 121, 311, 411 ] f1 = Fiber(c1, p1) c = [2, 4] f = Fiber(c, [f0, f1]) # This just creates another level... f.splitUnEqualBelow([3, 3, 1], depth=0) f_ref = deepcopy(f) f.splitEqualBelow(2, depth=1) for fc, fp in f_ref: fp.splitEqualBelow(2) self.assertEqual(f, f_ref)