Пример #1
0
    def test_6(self):
        x = ['4', '+', [['3', '+', '1'], '!']]
        result = parse(x)

        self.assertEqual(result, [
            '+', ['4', [], []], ['!', ['+', ['3', [], []], ['1', [], []]], []]
        ])
Пример #2
0
 def testLongList(self):
     result = parse([['4', '+', '3'], '*', '7', '+',
                     ['4', '+', [['3', '+', '1'], '!']]])
     self.assertEqual(result, [
         '+', ['*', ['+', ['4', [], []], ['3', [], []]], ['7', [], []]],
         [
             '+', ['4', [], []],
             ['!', ['+', ['3', [], []], ['1', [], []]], []]
         ]
     ])
Пример #3
0
 def testOne(self):
     result = parse(['1'])
     self.assertEqual(result, ['1', [], []])
Пример #4
0
 def testEmpty(self):
     result = parse([])
     self.assertEqual(result, [])
Пример #5
0
 def testFactorial(self):
     result = parse(['2', '!'])
     self.assertEqual(result, ['!', ['2', [], []], []])
Пример #6
0
 def test_1(self):
     x = [['4', '+', '3'], '*', '7']
     result = parse(x)
     self.assertEqual(
         result, ['*', ['+', ['4', [], []], ['3', [], []]], ['7', [], []]])
Пример #7
0
    def test_6(self):
        x = [['4'], '+', ['3'], '+', '6']
        result = parse(x)

        self.assertEqual(
            result, ['+', ['+', ['4', [], []], ['3', [], []]], ['6', [], []]])
Пример #8
0
    def test_3(self):
        x = ['3', '/', '6', '-', '9']
        result = parse(x)

        self.assertEqual(
            result, ['-', ['/', ['3', [], []], ['6', [], []]], ['9', [], []]])
Пример #9
0
    def test_2(self):
        x = ['2', '!']
        result = parse(x)

        self.assertEqual(result, ['!', ['2', [], []], []])