def test_tm1io_input_values_output_view(self): # define output view mdx_output = MDX_TEMPLATE_SHORT.format( rows="{[" + DIMENSION_NAMES[0] + "].[Element_1]}", columns="{[" + DIMENSION_NAMES[1] + "].[Element_1]}", cube=CUBE_NAME_TARGET) view_output = MDXView(cube_name=CUBE_NAME_TARGET, view_name=VIEW_NAME_TARGET, MDX=mdx_output) self.tm1.cubes.views.create(view=view_output, private=False) # execute method stdev_p(tm1_services={"tm1srv01": self.tm1}, tm1_target="tm1srv01", cube_target=CUBE_NAME_TARGET, view_target=VIEW_NAME_TARGET, values=STDEV_INPUT_VALUES, tidy=False) # do check result = next( self.tm1.cubes.cells.execute_view_values( cube_name=CUBE_NAME_TARGET, view_name=VIEW_NAME_TARGET, private=False)) self.assertAlmostEqual(result, STDEV_P_EXPECTED_RESULT, delta=STDEV_TOLERANCE)
def test_tm1tidy_false_input_view(self): # define input view and output view mdx_input = MDX_TEMPLATE_SHORT.format( rows="{ HEAD ( { [" + DIMENSION_NAMES[0] + "].Members}," + str(len(STDEV_INPUT_VALUES)) + ") }", columns="{[" + DIMENSION_NAMES[1] + "].[Element_1]}", cube=CUBE_NAME_SOURCE) view_input = MDXView(cube_name=CUBE_NAME_SOURCE, view_name=VIEW_NAME_SOURCE, MDX=mdx_input) self.tm1.cubes.views.create(view=view_input, private=False) # write values into input view mdx = view_input.MDX self.tm1.cubes.cells.write_values_through_cellset( mdx, STDEV_INPUT_VALUES) # execute method stdev_p(tm1_services={"tm1srv01": self.tm1}, tm1_source="tm1srv01", cube_source=CUBE_NAME_SOURCE, view_source=VIEW_NAME_SOURCE, tidy=False) self.assertTrue( self.tm1.cubes.views.exists(cube_name=CUBE_NAME_SOURCE, view_name=VIEW_NAME_SOURCE, private=False))
def test_stdev_p(self): result = stdev_p(values=STDEV_INPUT_VALUES) self.assertAlmostEqual(result, STDEV_P_EXPECTED_RESULT, delta=STDEV_TOLERANCE)