def test_merge_from_map(self): imports = {'foo': ('path1',), 'bar': ('path2',)} target_trees = {'foo': self.content_tree, 'bar': self.content_tree} merged_tree = merge_imports_tree(self.cache, imports, target_trees) merged_dir = create_dir() self.cache.export_tree(merged_tree, merged_dir) expected_content = {'path1/a': 'a', 'path2/a': 'a'} assert_contents(merged_dir, expected_content)
def test_merge_from_map(self): imports = {'foo': ('path1', ), 'bar': ('path2', )} target_trees = {'foo': self.content_tree, 'bar': self.content_tree} merged_tree = yield from merge_imports_tree(self.cache, imports, target_trees) merged_dir = create_dir() yield from self.cache.export_tree(merged_tree, merged_dir) expected_content = {'path1/a': 'a', 'path2/a': 'a'} assert_contents(merged_dir, expected_content)
def test_merge_from_list(self): # This represents a list of key-value pairs in YAML, for example: # imports: # - foo: path1 # - foo: path2 imports_list = [{'foo': 'path1'}, {'foo': 'path2'}] imports = build_imports(imports_list) target_trees = {'foo': self.content_tree} merged_tree = merge_imports_tree(self.cache, imports, target_trees) merged_dir = create_dir() self.cache.export_tree(merged_tree, merged_dir) expected_content = {'path1/a': 'a', 'path2/a': 'a'} assert_contents(merged_dir, expected_content)
def test_merge_from_multimap(self): # This represents a list of key-value pairs in YAML, for example: # imports: # foo: # - path1 # - path2 imports = {'foo': ('path1', 'path2')} target_trees = {'foo': self.content_tree} merged_tree = merge_imports_tree(self.cache, imports, target_trees) merged_dir = create_dir() self.cache.export_tree(merged_tree, merged_dir) expected_content = {'path1/a': 'a', 'path2/a': 'a'} assert_contents(merged_dir, expected_content)
def test_merge_from_multimap(self): # This represents a list of key-value pairs in YAML, for example: # imports: # foo: # - path1 # - path2 imports = {'foo': ('path1', 'path2')} target_trees = {'foo': self.content_tree} merged_tree = yield from merge_imports_tree(self.cache, imports, target_trees) merged_dir = create_dir() yield from self.cache.export_tree(merged_tree, merged_dir) expected_content = {'path1/a': 'a', 'path2/a': 'a'} assert_contents(merged_dir, expected_content)