Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_execute_mdx_rows_and_values_string_set_include_empty(self):
mdx = MdxBuilder.from_cube(STRING_CUBE_NAME) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[0])) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[1])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[2])) \
.to_mdx()
elements_and_string_values = self.tm1.cubes.cells.execute_mdx_rows_and_values_string_set(
mdx=mdx,
exclude_empty_cells=False)
self.assertEqual(
set(elements_and_string_values),
{"d1e1", "d1e2", "d1e3", "d1e4", "d2e1", "d2e2", "d2e3", "d2e4", "String1", "String2", "String3", ""})
def test_execute_view_rows_and_values_string_set(self):
mdx = MdxBuilder.from_cube(STRING_CUBE_NAME) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[0])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[2])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[1])) \
.to_mdx()
view_name = "some view"
view = MDXView(cube_name=STRING_CUBE_NAME, view_name=view_name, MDX=mdx)
self.tm1.cubes.views.create(view, private=False)
elements_and_string_values = self.tm1.cubes.cells.execute_view_rows_and_values_string_set(
cube_name=STRING_CUBE_NAME,
view_name=view_name,
private=False)
self.assertEqual(
set(elements_and_string_values),
{"d1e1", "d1e2", "d1e3", "d1e4", "String1", "String2", "String3"})
def test_execute_view_rows_and_values_string_set(self):
mdx = MdxBuilder.from_cube(STRING_CUBE_NAME) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[0])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[2])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[1])) \
.to_mdx()
view_name = "some view"
view = MDXView(cube_name=STRING_CUBE_NAME, view_name=view_name, MDX=mdx)
self.tm1.cubes.views.create(view, private=False)
elements_and_string_values = self.tm1.cubes.cells.execute_view_rows_and_values_string_set(
cube_name=STRING_CUBE_NAME,
view_name=view_name,
private=False)
self.assertEqual(
set(elements_and_string_values),
{"d1e1", "d1e2", "d1e3", "d1e4", "String1", "String2", "String3"})
def test_execute_mdx_rows_and_values_string_set_two_row_dimensions(self):
mdx = MdxBuilder.from_cube(STRING_CUBE_NAME) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[0])) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[1])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[2])) \
.to_mdx()
elements_and_string_values = self.tm1.cubes.cells.execute_mdx_rows_and_values_string_set(mdx)
self.assertEqual(
set(elements_and_string_values),
{"d1e1", "d1e2", "d1e3", "d1e4", "d2e1", "d2e2", "d2e3", "d2e4", "String1", "String2", "String3"})
def test_execute_mdx_rows_and_values_string_set_one_row_dimension(self):
mdx = MdxBuilder.from_cube(STRING_CUBE_NAME) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[0])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[1])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[2])) \
.to_mdx()
elements_and_string_values = self.tm1.cubes.cells.execute_mdx_rows_and_values_string_set(mdx)
self.assertEqual(
set(elements_and_string_values),
{"d1e1", "d1e2", "d1e3", "d1e4", "String1", "String2", "String3"})
def test_execute_mdx_rows_and_values_string_set_include_empty(self):
mdx = MdxBuilder.from_cube(STRING_CUBE_NAME) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[0])) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[1])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[2])) \
.to_mdx()
elements_and_string_values = self.tm1.cubes.cells.execute_mdx_rows_and_values_string_set(
mdx=mdx,
exclude_empty_cells=False)
self.assertEqual(
set(elements_and_string_values),
{"d1e1", "d1e2", "d1e3", "d1e4", "d2e1", "d2e2", "d2e3", "d2e4", "String1", "String2", "String3", ""})
def test_execute_mdx_with_top_skip(self):
mdx = MdxBuilder.from_cube(CUBE_NAME) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(DIMENSION_NAMES[0]).head(2)) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(DIMENSION_NAMES[1]).head(2)) \
.where(Member.of(DIMENSION_NAMES[2], "Element1")) \
.to_mdx()
cells = self.tm1.cubes.cells.execute_mdx(mdx=mdx, top=1, skip=2)
self.assertEqual(len(cells), 1)
elements = element_names_from_element_unique_names(list(cells.keys())[0])
self.assertEqual(elements, ("Element 2", "Element 1", "Element 1"))
def test_execute_mdx_rows_and_values_string_set_two_row_dimensions(self):
mdx = MdxBuilder.from_cube(STRING_CUBE_NAME) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[0])) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[1])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[2])) \
.to_mdx()
elements_and_string_values = self.tm1.cubes.cells.execute_mdx_rows_and_values_string_set(mdx)
self.assertEqual(
set(elements_and_string_values),
{"d1e1", "d1e2", "d1e3", "d1e4", "d2e1", "d2e2", "d2e3", "d2e4", "String1", "String2", "String3"})
def test_execute_mdx_rows_and_values_string_set_one_row_dimension(self):
mdx = MdxBuilder.from_cube(STRING_CUBE_NAME) \
.add_hierarchy_set_to_row_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[0])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[1])) \
.add_hierarchy_set_to_column_axis(MdxHierarchySet.tm1_subset_all(STRING_DIMENSION_NAMES[2])) \
.to_mdx()
elements_and_string_values = self.tm1.cubes.cells.execute_mdx_rows_and_values_string_set(mdx)
self.assertEqual(
set(elements_and_string_values),
{"d1e1", "d1e2", "d1e3", "d1e4", "String1", "String2", "String3"})