Fixed #18 : Parsing and evaluating Python
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import pytest
|
||||
|
||||
from core.error import ErrorContext, ErrorObj, MethodAccessError
|
||||
|
||||
|
||||
class DummyErrorObj(ErrorObj):
|
||||
def __init__(self, msg):
|
||||
self.msg = msg
|
||||
|
||||
def get_error_msg(self) -> str:
|
||||
return self.msg
|
||||
|
||||
|
||||
@pytest.mark.parametrize("error_hint, expected", [
|
||||
("some value", "some value"),
|
||||
(["value a", "value b"], "value a, value b"),
|
||||
(MethodAccessError("a"), "Cannot access method 'a'"),
|
||||
(DummyErrorObj("error msg"), "error msg")
|
||||
])
|
||||
def test_i_can_get_error_msg(context, error_hint, expected):
|
||||
error = ErrorContext("Test", context, error_hint)
|
||||
assert error.get_error_msg() == expected
|
||||
Reference in New Issue
Block a user