def test_remove_option(): updater = ConfigUpdater() updater.read_string(test1_cfg_in) updater.remove_option('default', 'key') assert str(updater) == test1_cfg_out_removed updater.remove_option('default', 'non_existent_key') updater.read_string(test1_cfg_in) del updater['default']['key'] assert str(updater) == test1_cfg_out_removed with pytest.raises(NoSectionError): updater.remove_option('wrong_section', 'key')
def test_remove_option(): updater = ConfigUpdater() updater.read_string(test1_cfg_in) updater.remove_option("default", "key") assert str(updater) == test1_cfg_out_removed updater.remove_option("default", "non_existent_key") updater.read_string(test1_cfg_in) del updater["default"]["key"] assert str(updater) == test1_cfg_out_removed with pytest.raises(NoSectionError): updater.remove_option("wrong_section", "key")