Commit 2211bbd6 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

REF: set partial_fill to False again

Still using `partial_fill` when creating FileTreeQuery
parent dd48efe0
...@@ -354,7 +354,7 @@ class FileTree(object): ...@@ -354,7 +354,7 @@ class FileTree(object):
self.variables = {} self.variables = {}
@classmethod @classmethod
def read(cls, tree_name: str, directory='.', partial_fill=True, **variables) -> "FileTree": def read(cls, tree_name: str, directory='.', partial_fill=False, **variables) -> "FileTree":
""" """
Reads a FileTree from a specific file Reads a FileTree from a specific file
......
...@@ -89,6 +89,8 @@ class FileTreeQuery(object): ...@@ -89,6 +89,8 @@ class FileTreeQuery(object):
:arg tree: The :class:`.FileTree` object :arg tree: The :class:`.FileTree` object
""" """
# Hard-code into the templates any pre-defined variables
tree = tree.partial_fill()
# Find all files present in the directory # Find all files present in the directory
# (as Match objects), and find all variables, # (as Match objects), and find all variables,
......
...@@ -13,14 +13,21 @@ def same_path(p1, p2): ...@@ -13,14 +13,21 @@ def same_path(p1, p2):
def test_simple_tree(): def test_simple_tree():
tree = filetree.FileTree.read('eddy') tree = filetree.FileTree.read('eddy')
assert 'basename' not in tree.variables assert 'basename' in tree.variables
same_path(tree.get('basename'), './eddy_output') same_path(tree.get('basename'), './eddy_output')
same_path(tree.get('image'), './eddy_output.nii.gz') same_path(tree.get('image'), './eddy_output.nii.gz')
same_path(tree.update(basename='eddy').get('image'), './eddy.nii.gz')
tree = filetree.FileTree.read('eddy.tree', basename='out') tree = filetree.FileTree.read('eddy.tree', basename='out')
assert 'basename' in tree.variables
same_path(tree.get('basename'), './out')
same_path(tree.update(basename='eddy').get('image'), './eddy.nii.gz')
tree = filetree.FileTree.read('eddy.tree', basename='out', partial_fill=True)
assert 'basename' not in tree.variables assert 'basename' not in tree.variables
same_path(tree.get('basename'), './out') same_path(tree.get('basename'), './out')
same_path(tree.update(basename='eddy').get('image'), './out.nii.gz')
with pytest.raises(ValueError): with pytest.raises(ValueError):
filetree.FileTree.read('non_existing') filetree.FileTree.read('non_existing')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment