Ejemplo n.º 1
0
    def test_initialization(self):
        """No dimension on initialization should raise an exception."""
        with self.assertRaises(ModelError):
            cubes.Hierarchy("default", [], self.dimension)

        with self.assertRaisesRegexp(ModelInconsistencyError, "not be empty"):
            cubes.Hierarchy("default", [])

        with self.assertRaisesRegexp(ModelInconsistencyError, "as strings"):
            cubes.Hierarchy("default", ["iamastring"])
Ejemplo n.º 2
0
 def test_initialization(self):
     """No dimension on initialization should raise an exception."""
     # self.assertRaises(ModelError, cubes.Hierarchy, "default", [self.levels[0]], None)
     self.assertRaises(ModelError, cubes.Hierarchy, "default", [],
                       self.dimension)
     hier = cubes.Hierarchy("default", [])
     try:
         foo = hier.levels
     except ModelInconsistencyError:
         pass
Ejemplo n.º 3
0
 def setUp(self):
     self.levels = [
         cubes.Level("year", attributes=["year"]),
         cubes.Level("month",
                     attributes=["month", "month_name", "month_sname"]),
         cubes.Level("day", attributes=["day"]),
         cubes.Level("week", attributes=["week"])
     ]
     self.level_names = [level.name for level in self.levels]
     self.dimension = cubes.Dimension("date", levels=self.levels)
     self.hierarchy = cubes.Hierarchy("default", ["year", "month", "day"],
                                      self.dimension)