def test_YggConfigParser(): r"""Ensure that get returns proper defaults etc.""" x = config.YggConfigParser() x.add_section('test_section') x.set('test_section', 'test_option', 'test_value') assert_equal(x.get('test_section', 'test_option'), 'test_value') assert_equal(x.get('test_section', 'fake_option'), None) assert_equal(x.get('test_section', 'fake_option', 5), 5) assert_equal(x.get('fake_section', 'fake_option'), None) assert_equal(x.get('fake_section', 'fake_option', 5), 5)
def test_YggConfigParser(): r"""Ensure that get returns proper defaults etc.""" x = config.YggConfigParser() x.add_section('test_section') x.set('test_section', 'test_option', 'test_value') assert_raises(RuntimeError, x.update_file) assert_equal(x.file_to_update, None) assert_equal(x.get('test_section', 'test_option'), 'test_value') assert_equal(x.get('test_section', 'fake_option'), None) assert_equal(x.get('test_section', 'fake_option', 5), 5) assert_equal(x.get('fake_section', 'fake_option'), None) assert_equal(x.get('fake_section', 'fake_option', 5), 5)
def test_YggConfigParser(): r"""Ensure that get returns proper defaults etc.""" x = config.YggConfigParser() x.add_section('test_section') x.set('test_section', 'test_option', 'test_value') with pytest.raises(RuntimeError): x.update_file() assert (x.file_to_update is None) assert (x.get('test_section', 'test_option') == 'test_value') assert (x.get('test_section', 'fake_option') is None) assert (x.get('test_section', 'fake_option', 5) == 5) assert (x.get('fake_section', 'fake_option') is None) assert (x.get('fake_section', 'fake_option', 5) == 5)