Exemple #1
0
 def test_main_output(self):
     captured_output = io.StringIO()
     sys.stdout = captured_output
     mn()
     sys.stdout = sys.__stdout__
     data = "".join(captured_output.getvalue().split())
     data1 = "Themostcommonwordsare:the1818and940to809of631it610she553you481said462in431alice403was358that330as274her248with228"
     self.assertEqual(data, data1)
    def test_main_output(self):
        captured_output = io.StringIO()
        sys.stdout = captured_output
        mn()
        sys.stdout = sys.__stdout__
        data = "".join(captured_output.getvalue().split())

        data1 = "infix: 4postfix:  4answer: 4.0infix: 5  +7postfix:  5 7 +answer: 12.0infix: 7*5postfix:  7 5 *answer: 35.0infix: (5-3)postfix:  5 3 -answer: 2.0infix: 5/5postfix:  5 5 /answer: 1.0infix: 8*5+3postfix:  8 5 * 3 +answer: 43.0infix: 8*(5+3)postfix:  8 5 3 + *answer: 64.0infix: 8+3*5-7postfix:  8 3 5 * + 7 -answer: 16.0infix: (8+3)*(5-6)postfix:  8 3 + 5 6 - *answer: -11.0infix: ((8+3)*(2-7))postfix:  8 3 + 2 7 - *answer: -55.0infix: ((8+3)*2)-7postfix:  8 3 + 2 * 7 -answer: 15.0infix: (8*5)+((3-2)-7*3)postfix:  8 5 * 3 2 - 7 3 * - +answer: 20.0infix: ((8*5+3)-7)-(5*3)postfix:  8 5 * 3 + 7 - 5 3 * -answer: 21.0infix: 7*9+7-5*6+3-4postfix:  7 9 * 7 + 5 6 * - 3 + 4 -answer: 39.0".replace(" ","")
        self.assertEqual(data, data1)
    def test_string(self):
        captured_output = io.StringIO()
        sys.stdout = captured_output
        mn()
        sys.stdout = sys.__stdout__
        data = "".join(captured_output.getvalue().split())

        data1 = "21,9,4,2,3,7,14,10,18,15,26,30,28,21(4)9(3)4(2)2(1)[Empty]3(0)[leaf]7(0)[leaf]14(2)10(0)[leaf]18(1)15(0)[leaf][Empty]26(2)[Empty]30(1)28(0)[leaf][Empty]26(3)10(2)2(1)[Empty]3(0)[leaf]14(0)[leaf]30(1)28(0)[leaf][Empty]"
        self.assertEqual(data, data1)
Exemple #4
0
    def test_main_output(self):
        captured_output = io.StringIO()
        sys.stdout = captured_output
        mn()
        sys.stdout = sys.__stdout__
        data = "".join(captured_output.getvalue().split())

        data1 = "Current List: (5)cs1030 Introduction to Computers Grade:3.2 Credit Hours: 2.0cs1400 Introduction to Programming Grade:3.6 Credit Hours: 4.0cs1410 C++ Programming Grade:2.6 Credit Hours: 4.0cs2420 Introduction to Data Structures Grade:3.2 Credit Hours: 4.0cs2810 Computer Architecture Grade:3.8 Credit Hours: 3.0Cumulative GPA: 3.259".replace(" ","")
        self.assertEqual(data, data1)