コード例 #1
0
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'
コード例 #2
0
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'