コード例 #1
0
def test_process_conf_dir(conf_dir):
    parser = create_conf_parser(str(conf_dir))
    obj = process_conf_files(parser)
    assert sorted(obj.keys()) == ["beverage", "food", "pet"]
    assert sorted(obj["beverage"].keys()) == ["Coffee", "Milk", "Tea"]
    assert sorted(obj["food"].keys()) == ["Bacon", "Egg", "Spam"]
    assert sorted(obj["pet"].keys()) == ["Cat", "Dog", "Snake"]
    assert obj["food"]["Bacon"] == {"taste": "Delicious"}
    assert obj["food"]["Spam"] == {"taste": "Sublime"}
コード例 #2
0
def test_create_conf_parser(conf_dir):
    conf_parser = create_conf_parser(str(conf_dir))
    assert "pet:Cat" in conf_parser.sections()
    assert "food:Bacon" in conf_parser.sections()
    assert "beverage:Coffee" in conf_parser.sections()
    assert "this-is:not" not in conf_parser.sections()