Ejemplo n.º 1
0
    def test_numericSorting(self):
        """
        Verifying reverse sorting with any '--numeric-sort or -n' command
        :return:
        """
        log = cl.custom_logger(logging.DEBUG)

        # getting list from unix command
        sortResultCmd = executecommand.commandExecutionCygwin("sort -n " +
                                                              numfile)

        # getting list from python sorted() method for verification
        sortResultPy = sortingPython.sortFileContent(numfile, int, False)

        # verifying both the lists
        TestClassSortingTest.verification(self, sortResultCmd, sortResultPy,
                                          log)
Ejemplo n.º 2
0
    def test_uniqueSorting(self):
        """
        Verifying reverse sorting with any '--unique or -u' command
        :return:
        """
        log = cl.custom_logger(logging.DEBUG)

        # getting list from unix command
        sortResultCmd = executecommand.commandExecutionCygwin("sort -u " +
                                                              file)

        # getting list from python sorted() method for verification
        sortResultPy = sortingPython.sortFileContentUnique(
            file, lambda v: (v.lower(), v[0].isupper()), False)

        # verifying both the lists
        TestClassSortingTest.verification(self, sortResultCmd, sortResultPy,
                                          log)
Ejemplo n.º 3
0
    def test_simpleSorting(self):
        """
        Verifying default sorting without any explicit command

        :return: test 1: simple sorting
        """
        log = cl.custom_logger(logging.DEBUG)

        # getting list from unix command
        sortResultCmd = executecommand.commandExecutionCygwin("sort " + file)

        # getting list from python sorted() method for verification
        sortResultPy = sortingPython.sortFileContent(
            file, lambda v: (v.lower(), v[0].isupper()), False)

        # verifying both the lists
        TestClassSortingTest.verification(self, sortResultCmd, sortResultPy,
                                          log)
Ejemplo n.º 4
0
    def test_generalNumericAndDictionarySorting(self):
        """
        verifying combination of --general-numeric-sort and --dictionary-order

        :return:Alpha Numeric sorting
        """
        log = cl.custom_logger(logging.DEBUG)

        # getting list from unix command
        sortResultCmd = executecommand.commandExecutionCygwin("sort -g " +
                                                              file +
                                                              " | sort -d " +
                                                              file + "")

        # getting list from python sorted() method for verification
        sortResultPy = sortingPython.sortFileContent(
            file, lambda v: (v.lower(), v[0].isupper()), False)

        # verifying both the lists
        TestClassSortingTest.verification(self, sortResultCmd, sortResultPy,
                                          log)