How to use the configupdater.DuplicateOptionError function in ConfigUpdater

To help you get started, we’ve selected a few ConfigUpdater examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyscaffold / configupdater / tests / test_configupdater.py View on Github external
def test_duplicate_option_error():
    updater = ConfigUpdater()
    with pytest.raises(DuplicateOptionError):
        updater.read_string(test10_dup_option)
github pyscaffold / configupdater / tests / test_configupdater.py View on Github external
def test_no_duplicate_blocks_with_blockbuilder():
    updater = ConfigUpdater()
    updater.read_string(test19_cfg_in)
    with pytest.raises(DuplicateOptionError):
        updater['section']['Key0'].add_after.option('key0', '1')
    with pytest.raises(DuplicateSectionError):
        updater['section'].add_after.section('section')
    assert str(updater) == test19_cfg_in