Пример #1
0
 def test_addition(self):
     value = equation_solver.evaluate('2+3')
     self.assertEqual(value, 5)
Пример #2
0
 def test_rearrangement(self):
     value = equation_solver.evaluate('2=84/   x')
     self.assertEqual(value, 42)
Пример #3
0
 def test_single_value(self):
     value = equation_solver.evaluate('15')
     self.assertEqual(value, 15)
Пример #4
0
 def test_assignment(self):
     value = equation_solver.evaluate('   x=14*3')
     self.assertEqual(value, 42)
Пример #5
0
 def test_brakets(self):
     value = equation_solver.evaluate('6*(4-2)')
     self.assertEqual(value, 12)
     value = equation_solver.evaluate('(8/(   6  + (-2)))')
     self.assertEqual(value, 2)
Пример #6
0
 def test_division(self):
     value = equation_solver.evaluate('-8    /4')
     self.assertEqual(value, -2)
Пример #7
0
 def test_multiplication(self):
     value = equation_solver.evaluate('6*9')
     self.assertEqual(value, 54)
Пример #8
0
 def test_subtraction(self):
     value = equation_solver.evaluate('7-      10')
     self.assertEqual(value, -3)