test_assignments.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:pyta 作者: pyta-uoft 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号