Example #1
0
class TestDatacubeManipulation(unittest.TestCase):

  """
  Tests the data manipulation functions of the datacube class.
  """
  
  def setUp(self):
    self._cube = Datacube()
    self._cube.addVariables(["x","y","z"])
  
  def tearDown(self):
    pass
    
  def test_set(self):
    pass
    
  def test_commit(self):
    pass
    
  def test_get_column(self):
    pass
    
  def test_create_column(self):
    pass
    
  def test_goto(self):
    pass
    
  def test_insert(self):
    pass
    
  def test_description(self):
    pass
    
  def test_name(self):
    pass
    
  def test_tags(self):
    pass
    
  def test_parameters(self):
    pass
    
  def test_table_geometry(self):
    pass
    
  def test_children(self):
    pass
    
  def test_addRoles(self):
    roles = ["somerole","anotherrole"]
    self._cube.addRoles("x",roles)
    self.assertEqual(self._cube.roles("x"),roles)
    
  def test_setRoles(self):
    roles = ["somerole","anotherrole"]
    self._cube.addRoles("x",["garbage"])
    self._cube.setRoles("x",roles)
    self.assertEqual(self._cube.roles("x"),roles)
    
  def test_variablesWithRoles(self):
    self._cube.setRoles("x",["1","2","3"])
    self._cube.setRoles("y",["2","3","4"])
    self._cube.setRoles("z",["3","4","5"])
    
    self.assertEqual(self._cube.variablesWithRoles(["1"]),["x"])
    self.assertEqual(self._cube.variablesWithRoles(["2"]),["x","y"])
    self.assertEqual(self._cube.variablesWithRoles(["3"]),["x","y","z"])
    self.assertEqual(self._cube.variablesWithRoles(["3","4"]),["y","z"])
    self.assertEqual(self._cube.variablesWithRoles(["3","4","5"]),["z"])