Esempio n. 1
0
    def test_sortLines_ignoreCase(self):

        with patch('sys.stdout', new=StringIO()) as mockStdout:
            inputLines = ['DEF', 'abc', 'JKL', 'ghi']
            options = {'ignoreCase': True}

            sort.sortLines(inputLines, options)

        self.assertTrue('abc\nDEF\nghi\nJKL\n' == mockStdout.getvalue())
Esempio n. 2
0
    def test_sortLines_withCaseDifferences(self):

        with patch('sys.stdout', new=StringIO()) as mockStdout:
            inputLines = ['DEF', 'abc', 'JKL', 'ghi']
            options = {}

            sort.sortLines(inputLines, options)

        self.assertTrue('DEF\nJKL\nabc\nghi\n' == mockStdout.getvalue())
Esempio n. 3
0
    def test_sortLines_noOptions(self):

        with patch('sys.stdout', new=StringIO()) as mockStdout:
            inputLines = ['def', 'abc', 'jkl', 'ghi']
            options = {}

            sort.sortLines(inputLines, options)

        self.assertTrue('abc\ndef\nghi\njkl\n' == mockStdout.getvalue())
Esempio n. 4
0
    def test_sortLines_specialCharacters(self):

        with patch('sys.stdout', new=StringIO()) as mockStdout:
            inputLines = ['+ghi', 'ab-c', 'def)', '[jkl']
            options = {}

            sort.sortLines(inputLines, options)

        self.assertTrue('+ghi\n[jkl\nab-c\ndef)\n' == mockStdout.getvalue())
Esempio n. 5
0
    def test_sortLines_dictionaryOrder(self):

        with patch('sys.stdout', new=StringIO()) as mockStdout:
            inputLines = ['+ghi', 'ab-c', 'def)', '[jkl']
            options = {'dictionaryOrder': True}

            sort.sortLines(inputLines, options)

#        sys.stderr.write( '[debug] result: \'' + mockStdout.getvalue() + '\'\n' )
        self.assertTrue('ab-c\ndef)\n+ghi\n[jkl\n' == mockStdout.getvalue())