def test_it_should_use_given_merger(self, examples): paths = examples.get_many(SORTED_FILES) def mymerge(configs): return configs config = load(paths, merger=mymerge) assert_that(config, only_contains(has_key('section')))
def test_it_should_use_given_parser(self): paths = ['/path/to/1', '/path/to/2'] def myparse(path, format=None): return {'path': path, 'format': format} config = load(paths, format='toml', parser=myparse) assert_that(config, has_entries({'path': paths[-1], 'format': 'toml'}))
def test_merges_must_retain_order(self, examples): examples.clear() paths = examples.get_many(FILES) config = load(paths) good_data = [ 'string', 'integer', 'float', 'boolean', 'list', 'key', 'unicode', 'subsection', 'null' ] assert_that(config["section"].keys(), contains(*good_data))
def test_it_should_load_paths_for_given_format(self, examples): paths = examples.get_many(['00_base.toml', 'basic_file_toml']) config = load(paths, format='toml') assert_that(config, has_entry('section', has_entry('key', 'basic')))
def test_it_should_load_and_merge_lists_of_paths(self, examples): paths = sorted(examples.get_many(SORTED_FILES)) config = load(paths) assert_that(config, has_entry('section', has_entry('key', 'second')))