Пример #1
0
def test_env_get_with_default():
    env = Environment({})
    assert env.get("<key>", default=None) is None
    assert env.get("<key>", default="banana") == "banana"
Пример #2
0
def test_env_get():
    env = Environment({"<key>": "1234"})
    assert env.get("<key>") == "1234"
Пример #3
0
def test_env_get_with_parser():
    env = Environment({"<key>": "1234"})
    assert env.get("<key>", parser=int) == 1234
Пример #4
0
def test_env_prefix():
    env = Environment({"APP_NAME": "banana"}, prefix="APP_")
    assert env("NAME").get() == "banana"
    assert env.get("NAME") == "banana"