Exemplo n.º 1
0
 def test_parse_error_lines_single_line_variables_and_constants(self):
     line = "x = y + 2 + z"
     result = frosch.parse_error_line(line)
     expected_result = [
         frosch.Variable("x", 0),
         frosch.Variable("y", 4),
         frosch.Variable("z", 12)
         ]
     self.assertCountEqual(result, expected_result)
Exemplo n.º 2
0
    def test_debug_variables_none_locals_globals(self):
        variables = [frosch.Variable("x", 4), frosch.Variable("y", 10)]

        _locals = {}
        _globals = {}

        expected_result = frosch.debug_variables(variables, _locals, _globals)

        for var in expected_result:
            self.assertIsNone(var.value, None)
Exemplo n.º 3
0
    def test_debug_variables(self):
        variables = [frosch.Variable("x", 4), frosch.Variable("y", 10)]

        _locals = {"x": "Hello", "y": 3}
        _globals = {}

        expected_result = frosch.debug_variables(variables, _locals, _globals)

        for variable in expected_result:
            if variable.name == "x":
                self.assertEqual(variable.value, '"Hello"')
                self.assertEqual(variable.type_name, "str")

            if variable.name == "y":
                self.assertEqual(variable.value, 3)
                self.assertEqual(variable.type_name, "int")
Exemplo n.º 4
0
 def test_parse_error_lines_single_line_simple(self):
     line = "x"
     result = frosch.parse_error_line(line)
     expected_result = [frosch.Variable("x", 0)]
     self.assertListEqual(result, expected_result)