Exemplo n.º 1
0
 def test_simple_addtion(self):
     self.assertEqual("['1', '+', '2']",
                      str(parse_calculator_string('1 + 2')))
Exemplo n.º 2
0
 def test_starting_with_negative_number(self):
     parsed = parse_calculator_string('-2 + 3')
     self.assertEqual("['-2', '+', '3']", str(parsed))
Exemplo n.º 3
0
 def test_invalid_calc_string_plus(self):
     with self.assertRaises(ParseException):
         parse_calculator_string(' + -2 + 3')
Exemplo n.º 4
0
 def test_variable_names(self):
     parsed = parse_calculator_string('a * b')
     self.assertEqual("['a', '*', 'b']", str(parsed))
Exemplo n.º 5
0
 def test_multiplication_with_negative_number(self):
     parsed = parse_calculator_string('1 * -2 + 3')
     self.assertEqual("['1', '*', '-2', '+', '3']", str(parsed))
Exemplo n.º 6
0
 def test_simple_multiplication(self):
     self.assertEqual("['1', '*', '2']",
                      str(parse_calculator_string('1 * 2')))
Exemplo n.º 7
0
 def test_multiple_terms(self):
     parsed = parse_calculator_string('1 * 2 + 3')
     self.assertEqual("['1', '*', '2', '+', '3']", str(parsed))
Exemplo n.º 8
0
 def test_invalid_calc_string_plus(self):
     with self.assertRaises(ParseException):
         parse_calculator_string(" + -2 + 3")
Exemplo n.º 9
0
 def test_simple_addtion(self):
     self.assertEqual("['1', '+', '2']", str(parse_calculator_string("1 + 2")))
Exemplo n.º 10
0
 def test_starting_with_negative_number(self):
     parsed = parse_calculator_string("-2 + 3")
     self.assertEqual("['-2', '+', '3']", str(parsed))
Exemplo n.º 11
0
 def test_multiplication_with_negative_number(self):
     parsed = parse_calculator_string("1 * -2 + 3")
     self.assertEqual("['1', '*', '-2', '+', '3']", str(parsed))
Exemplo n.º 12
0
 def test_variable_names(self):
     parsed = parse_calculator_string("a * b")
     self.assertEqual("['a', '*', 'b']", str(parsed))
Exemplo n.º 13
0
 def test_multiple_terms(self):
     parsed = parse_calculator_string("1 * 2 + 3")
     self.assertEqual("['1', '*', '2', '+', '3']", str(parsed))
Exemplo n.º 14
0
 def test_simple_multiplication(self):
     self.assertEqual("['1', '*', '2']", str(parse_calculator_string("1 * 2")))