Exemplo n.º 1
0
def test_string(value, monkeypatch):
    key = "VALID_STRING"
    monkeypatch.setenv(key, value)
    assert env(key, str) == value
Exemplo n.º 2
0
def test_invalid_bool(value, monkeypatch):
    key = "INVALID_BOOL"
    monkeypatch.setenv(key, value)
    with pytest.raises(ValueError):
        env(key, bool)
Exemplo n.º 3
0
def test_invalid_int(value, monkeypatch):
    key = "INVALID_INT"
    monkeypatch.setenv(key, value)
    with pytest.raises(ValueError):
        env(key, int)
Exemplo n.º 4
0
def test_int(monkeypatch):
    key = "VALID_INT"
    monkeypatch.setenv(key, "42")
    assert env(key, int) == 42
Exemplo n.º 5
0
def test_bool_negative(value, monkeypatch):
    key = "VALID_BOOL_NEG"
    monkeypatch.setenv(key, value)
    assert env(key, bool) == False
Exemplo n.º 6
0
def test_bool_positive(value, monkeypatch):
    key = "VALID_BOOL_POS"
    monkeypatch.setenv(key, value)
    assert env(key, bool) == True