def test_name_once(): var = EnvVar() assert not var.name var.name = 'FOO' assert var.name == 'FOO' with pytest.raises(AssertionError) as e: var.name = 'BAR' assert str(e.value) == 'EnvVar name is immutable once set'
def test_name_mixed_case_error(): var = EnvVar() with pytest.raises(AssertionError) as e: var.name = 'foo' assert str(e.value) == 'EnvVar name must be uppercase'