Skip to content

Commit

Permalink
Accept Node instances in Model.export(). (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-hen committed Apr 6, 2021
1 parent 7894048 commit aea55f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 0 additions & 2 deletions mph/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,6 @@ def export(self, node, file=None):
node = self/node
else:
node = self/'exports'/node
else:
node = Node(node)
if not node.exists():
logger.warning('Node does not exist in model tree')
return
Expand Down
9 changes: 9 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,15 @@ def test_export():
model.export('field')
assert (here/'field.txt').exists()
(here/'field.txt').unlink()
assert not (here/'field.txt').exists()
model.export('exports/field')
assert (here/'field.txt').exists()
(here/'field.txt').unlink()
assert not (here/'field.txt').exists()
model.export(model/'exports'/'field')
assert (here/'field.txt').exists()
(here/'field.txt').unlink()
assert not (here/'field.txt').exists()
assert not (here/'field2.txt').exists()
model.export('exports/field', here/'field2.txt')
assert (here/'field2.txt').exists()
Expand Down

0 comments on commit aea55f4

Please sign in to comment.