예제 #1
0
    def test_with_letters(self):
        with self.assertRaises(RuntimeError) as cm:
            rpn.split_on_elements('10 + 10abc')

        self.assertIn('invalid symbol', str(cm.exception))
예제 #2
0
 def test_split(self):
     result = rpn.split_on_elements("10+10*10")
     self.assertEqual(
         ["10", "+", "10", "*", "10"],
         result,
     )
예제 #3
0
 def test_split_with_parentheless(self):
     result = rpn.split_on_elements("(1 + 2) * 2")
     self.assertEqual(
         ["(", "1", "+", "2", ")", "*", "2"],
         result,
     )