def test_check_monotonic_incorrect(self):
        prev = [36,1,2,3,4,5,6,7,8,9]
        curr = [44,2,1,4,5,6,7,8,9,10]
        expectedOutput = "Monotonic error at column 2 comparing lines -1 and 0   values 1 and 2\n"

        with patch('sys.stdout', new = StringIO()) as fake_out: 
                check_monotonic(0,prev,curr)
                self.assertEqual(fake_out.getvalue(), expectedOutput)
    def test_check_monotonic_correctTALLdeclining(self):
        prev = [36,1,2,3,4,5,6,7,8,9]
        curr = [23,2,3,4,5,6,7,8,9,10]
        expectedOutput = ""

        with patch('sys.stdout', new = StringIO()) as fake_out: 
                check_monotonic(0,prev,curr)
                self.assertEqual(fake_out.getvalue(), expectedOutput)
    def test_MonotonicCheck(self):
        captureOutput = io.StringIO()
        sys.stdout = captureOutput
        check_monotonic(prev, currTester)
        sys.stdout = sys.__stdout__

        n = 4

        self.assertEqual(
            captureOutput.getvalue(),
            'Monotonic error at column 0 comparing lines 21 and 22   values 712 and 800\n'
        )
Exemple #4
0
 def test_CheckMonoError(self):
     testPrev = [200, 10, 10, 20, 20, 50, 20, 20, 50, 0]
     testCurr = [206, 9, 11, 21, 21, 51, 21, 21, 51, 0]
     result = datamunger.check_monotonic(testPrev, testCurr)
     self.assertEqual(
         result,
         "Monotonic error at column 1 comparing lines 57 and 58 values 9 and 10"
     )
Exemple #5
0
 def test_CheckMono(self):
     testPrev = [200, 10, 10, 20, 20, 50, 20, 20, 50, 0]
     testCurr = [208, 11, 11, 21, 21, 51, 21, 21, 51, 0]
     result = datamunger.check_monotonic(testPrev, testCurr)
     self.assertEqual(result, "")