def test_dimension_count(self): m1 = [[1 for _ in range(4)] for _ in range(3)] m2 = [[2 for _ in range(4)] for _ in range(5)] self.assertEqual(util.dimension_count(m1), 2) self.assertEqual(util.dimension_count(m2), 2) m = [m1, m2] self.assertEqual(util.dimension_count(m), 3) self.assertEqual(util.dimension_count([]), 1) self.assertEqual(util.dimension_count([[]]), 2) self.assertEqual(util.dimension_count([[[]]]), 3)
def get_replica_vbuckets(self): result = self.vbmap_model.get_variable("rvb") if util.dimension_count(result) == 2: result = util.accumulate(result, util.add_to) return result