def test_global_read_write(): y = Instance(TEST_BYTES).globals.y assert y.value == 7 y.value = 8 assert y.value == 8
def test_global_read_write_constant(): z = Instance(TEST_BYTES).globals.z assert z.value == 42 with pytest.raises(RuntimeError) as context_manager: z.value = 153 exception = context_manager.value assert str(exception) == ( 'The global variable `z` is not mutable, cannot set a new value.')