def test_SortColumns_usingCellValue_invalid(self):

        m, x = make_matrix()
        _usingCellValue = 3

        with self.assertRaisesRegexp(IndexError, 'index out of range'):
            v4_2_support.SortColumns(Matrix=m, usingCellValue=_usingCellValue)
        print "test_SortColumns_usingCellValue_invalid", _usingCellValue
    def test_SortColumns_ascending(self):

        m, x = make_matrix()
        _descending = False
        _matrix_labels = self._sorting_order_columns(m, descending=_descending)
        v4_2_support.SortColumns(Matrix=m, descending=_descending)
        _labels = self._get_labels_from_m_columns(m, descending=_descending)

        self.assertTrue(_labels.difference(_matrix_labels) == set([]))
        print "test_SortColumns_ascending", _labels
    def test_SortColumns_byRow(self):

        m, x = make_matrix()
        _sort_row = 2
        _matrix_labels = self._sorting_order_columns(m, byRow=_sort_row)
        v4_2_support.SortColumns(Matrix=m, byRow=_sort_row)
        _labels = self._get_labels_from_m_columns(m, byRow=_sort_row)

        self.assertTrue(_labels.difference(_matrix_labels) == set([]))
        print "test_SortColumns_byRow", _labels
    def test_SortColumns_byRow_invalid(self):

        m, x = make_matrix()

        _sort_row = 100

        with self.assertRaisesRegexp(IndexError, 'index out of range'):

            v4_2_support.SortColumns(Matrix=m, byRow=_sort_row)

        print "test_SortColumns_byRow_invalid", "_sort_row = ", _sort_row
    def test_SortColumns_usingCellValue(self):

        m, x = make_matrix()
        _usingCellValue = 0
        _matrix_labels = self._sorting_order_columns(
            m, usingCellValue=_usingCellValue)
        v4_2_support.SortColumns(Matrix=m, usingCellValue=_usingCellValue)
        _labels = self._get_labels_from_m_columns(
            m, usingCellValue=_usingCellValue)

        self.assertTrue(_labels.difference(_matrix_labels) == set([]))
        print "test_SortColumns_usingCellValue", _labels
    def test_SortColumns_with_all_options(self):

        m, x = make_matrix()
        _byRow = 2
        _usingCellValue = 0
        _descending = False
        _matrix_labels = self._sorting_order_columns(
            m,
            byRow=_byRow,
            usingCellValue=_usingCellValue,
            descending=_descending)
        v4_2_support.SortColumns(Matrix=m,
                                 byRow=_byRow,
                                 usingCellValue=_usingCellValue,
                                 descending=_descending)
        _labels = self._get_labels_from_m_columns(
            m,
            byRow=_byRow,
            usingCellValue=_usingCellValue,
            descending=_descending)

        self.assertTrue(_labels.difference(_matrix_labels) == set([]))
        print "test_SortColumns_with_all_options", _labels