Skip to content

Commit

Permalink
Relaxed test assertions when comparing tags with reference model.
Browse files Browse the repository at this point in the history
`test_tag()` in `test_node.py` compares the node tags generated by MPh
with the tags created by Comsol for the same model. The reference model
is the demo model from the Tutorial. It was created with Comsol 5.5 and
then saved to a file, stored in the `demos` folder. Newer Comsol versions
(such as 6.0, see #67) may create default nodes that older versions didn't.
To future-proof the test, we therefore only compare the tags if the node
already existed in the reference model, but ignore "new" nodes (if any)
possibly introduced by later Comsol versions.
  • Loading branch information
john-hen committed Feb 9, 2022
1 parent 82e4c70 commit 0b9e8e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def test_name():


def compare_tags(node, other):
assert (other/node).exists()
assert node.tag() == (other/node).tag() or node.is_root()
if not node.is_root() and (other/node).exists():
assert node.tag() == (other/node).tag()
for child in node:
compare_tags(child, other)

Expand Down

0 comments on commit 0b9e8e0

Please sign in to comment.