Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def custom_generate_error(node, resources):
error_code = eval(utils.generic_ast_node_transform(node.args[0], resources))
except NameError:
raise TranslateError(_errormessages.invalid_error_code_for_generate_error)
message = node.args[1].s
message = node.args[1].value
action = ErrorAction[node.args[2].attr]
realtimesequencedefinition.add_generate_error(
resources.get_current_block(), error_code, message, action.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _decorator_to_arg(node, resources):
by_value_str = utils.get_variable_name_from_node(node.args[2])
by_value_str = getattr(_decorators.NivsParam, by_value_str.split(".")[-1], by_value_str)
by_value = BooleanValue(by_value_str).value
elif "NameConstant" in dir(ast) and utils.is_node_ast_nameconstant(node.args[2]):
elif "Constant" in dir(ast) and utils.is_node_ast_nameconstant(node.args[2]):
by_value = utils.get_value_from_nameconstant_node(node.args[2])

if arg_name is None or def_value is None or by_value is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@


def test_true_node_returns_true_string():
node = ast.NameConstant(value=True)
node = ast.Constant(value=True)
res = nameconstant_transformer.nameconstant_transformer(node, None)
assert res == "true"


def test_false_node_returns_false_string():
node = ast.NameConstant(value=False)
node = ast.Constant(value=False)
res = nameconstant_transformer.nameconstant_transformer(node, None)
assert res == "false"


def test_none_node_throws():
node = ast.NameConstant(value=None)
node = ast.Constant(value=None)
with pytest.raises(errors.TranslateError):
nameconstant_transformer.nameconstant_transformer(node, None)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ deps =
flake8-junit-report
commands =
- flake8 src/niveristand/ tests/ examples/ setup.py --exclude tests/legacy,tests/sdf_api,_auto_generated_classes.py,src/niveristand/**/__init__.py --output-file {envlogdir}/{envname}.txt --tee
python -c "open(r'{envlogdir}/{envname}.txt', 'a').close()"
flake8_junit {envlogdir}/{envname}.txt {envlogdir}/junit-{envname}.xml

[flake8]
Expand Down