def test_set_env(variables_dict):
"""Test environment setting visitors"""
program = cs._parse_dictionary_to_program(variables_dict)
module, _ = cs._parse_text(program)
# get list of variable names in locals
local_values = [module.type_environment.locals[name] for name in module.type_environment.locals]
global_values = [module.type_environment.globals[name] for name in module.type_environment.globals]
# verify the type of the value of each variable in the environment
for value in local_values:
assert isinstance(value, TypeVar)
for value in global_values:
assert isinstance(value, TypeVar)
评论列表
文章目录