本文整理汇总了Python中pyview.lib.datacube.Datacube.addRoles方法的典型用法代码示例。如果您正苦于以下问题:Python Datacube.addRoles方法的具体用法?Python Datacube.addRoles怎么用?Python Datacube.addRoles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyview.lib.datacube.Datacube
的用法示例。
在下文中一共展示了Datacube.addRoles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestDatacubeManipulation
# 需要导入模块: from pyview.lib.datacube import Datacube [as 别名]
# 或者: from pyview.lib.datacube.Datacube import addRoles [as 别名]
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"])