def test_redefine_variables_illegal(): """TEST 4.7: Variables can only be defined once. Setting a variable in an environment where it is already defined should result in an appropriate error. """ env = Environment({"foo": 1}) with assert_raises_regexp(DiyLangError, "already defined"): env.set("foo", 2)
def test_redefine_variables_illegal(): """Variables can only be defined once. Setting a variable in an environment where it is already defined should result in an appropriate error. """ env = Environment({"foo": 1}) with assert_raises_regexp(DiyLangError, "already defined"): env.set("foo", 2)
def test_set_changes_environment_in_place(): """TEST 4.6: When calling `set` the environment should be updated""" env = Environment() env.set("foo", 2) assert_equals(2, env.lookup("foo"))
def test_set_changes_environment_in_place(): """When calling `set` the environment should be updated""" env = Environment() env.set("foo", 2) assert_equals(2, env.lookup("foo"))