def test_convert_significance_results_to_arrows(self):
     m,x = _make_matrix()
     self._addStatsTestsToMatrix(m)
     x.convert_significance_results_to_arrows()
     utilities.print_matrix(m)
     self.assertEqual(m[0][0].SigTestResult, u'\xea')
     print "test_convert_significance_results_to_arrows ", m[0][0].SigTestResult
 def test_sort_rows_with_all_options(self):
     m, x = _make_matrix()
     _by_column = 2
     _using_cell_value = 0
     _descending = False
     _file_name = "utils\\file_name.txt"
     if use_test_data == True:
         _client_name = "myRow 2"
     else:
         _client_name = "Somewhat Agree"
     _matrix_labels = self._sorting_order_rows(
         m,
         by_column=_by_column,
         using_cell_value=_using_cell_value,
         descending=_descending,
         file_name=_file_name,
         client_name=_client_name)
     x.sort_rows(by_column=_by_column,
                 using_cell_value=_using_cell_value,
                 descending=_descending,
                 file_name=_file_name,
                 client_name=_client_name)
     _labels = self._get_labels_from_m_rows(
         m,
         by_column=_by_column,
         using_cell_value=_using_cell_value,
         descending=_descending,
         file_name=_file_name,
         client_name=_client_name)
     utilities.print_matrix(m)
     print "_labels", _labels
     print "_matrix_labels", _matrix_labels
     self.assertTrue(_labels.difference(_matrix_labels) == set([]))
     print "test_sort_rows_with_all_options", _labels
    def insert_category(self,
                        matrix,
                        logger,
                        row_number=0,
                        column_number=0,
                        label="",
                        *args):
        """Insert a column into the Matrix.

        :param column_number: position to insert the column. Default = 0
        :param label: label for the inserted column. Default = ""

        Example:

        | tr = transformations.MatrixManipulator(Matrix)
        | tr.insert_category(column_number=3, label = "Inserted Column")
        
        """

        if column_number > matrix.TopAxis.DataMembers.Count - 1:
            logger("cannot insert category, not enough columns")
            return

        _member = matrix[0][column_number].TopMember
        _name = "new_column" + str(column_number)
        _new_column = matrix.InsertBlankColumnAfter(_member, _name, label)

        import utils.utilities as utilities
        utilities.print_matrix(matrix)
        matrix.SwitchColumns(_member.DataIndex, _new_column.DataIndex)
 def test_sort_columns_ascending(self):
     m, x = _make_matrix()
     utilities.print_matrix(m)
     _descending = False
     x.sort_columns(descending=_descending)
     _matrix_labels = self._sorting_order_columns(m, descending=_descending)
     _labels = self._get_labels_from_m_columns(m, descending=_descending)
     self.assertTrue(_labels.difference(_matrix_labels) == set([]))
     print "test_sort_columns_ascending", _labels
 def test_get_category_labels_failure(self):
     m, x = make_matrix()
     _matrix_labels = [col.TopMember.Label for col in m[0]]
     #add failure scenario to matrix
     m.DeleteColumn(0)
     _labels = x.get_category_labels()
     with self.assertRaises(AssertionError):
         self.assertEqual(_labels, _matrix_labels)
     print "test_get_category_labels_failure - col0 missing:"
     utilities.print_matrix(m)
    def test_sort_columns_nets_client_name(self):
        global mtd_filepath
        mtd_filepath = os.path.abspath(os.path.join('utils\\SmokeTest_v3.mtd'))

        table_selected = 86

        print ""
        print "This regression test is run using DATA Containing Nets"
        print ""

        m, x = _make_matrix(table_selected=table_selected)
        _sort_row = 0
        _using_cell_value = 0
        _descending = True
        _file_name = None
        _client_name = "25-34 years"
        _matrix_labels = self._sorting_order_columns(
            m,
            by_row=_sort_row,
            using_cell_value=_using_cell_value,
            descending=_descending,
            file_name=_file_name,
            client_name=_client_name)
        x.sort_columns(m,
                       by_row=_sort_row,
                       using_cell_value=_using_cell_value,
                       descending=_descending,
                       file_name=_file_name,
                       client_name=_client_name)
        _labels = self._get_labels_from_m_columns(
            m,
            by_row=_sort_row,
            using_cell_value=_using_cell_value,
            descending=_descending,
            file_name=_file_name,
            client_name=_client_name)
        #print "test_sort_columns_default", _labels
        #print "_matrix_labels", _matrix_labels
        self.assertTrue(_labels.difference(_matrix_labels) == set([]))
        print "test_sort_rows_nets_client_name", _labels
        utilities.print_matrix(m)