Пример #1
0
def test_config_update() -> None:
    config = Config()
    config.update(config.dump())
    assert config == Config()
Пример #2
0
def test_config_update_bad_data_format(data: Any) -> None:
    config = Config()
    with pytest.raises(ConfigFileError) as err:
        # noinspection PyTypeChecker
        config.update(data)
    assert str(err.value).startswith("B")
Пример #3
0
def test_config_update_bad_key(key: str) -> None:
    config = Config()
    with pytest.raises(ConfigKeyError) as err:
        config.update({key: None})
    assert str(err.value).startswith("Bad configuration key")
Пример #4
0
def test_config_update_bad_value(key):
    config = Config()
    with pytest.raises(ConfigValueError) as err:
        config.update({key: None})
    assert str(err.value).startswith("Bad value for configuration key")