Skip to content

Match error message in function graph tests #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions tests/graph/test_fg.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,23 @@ def test_validate_inputs(self):
var1 = op1()
var2 = op2()

with pytest.raises(TypeError):
with pytest.raises(TypeError, match="'Variable' object is not iterable"):
FunctionGraph(var1, [var2])

with pytest.raises(TypeError):
with pytest.raises(TypeError, match="'Variable' object is not reversible"):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one end the above error message is slightly not clear to me. It did not refer to inputs or outputs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to improve the error message

FunctionGraph([var1], var2)

with pytest.raises(ValueError):
with pytest.raises(
ValueError,
match=(
"One of the provided inputs is the output of an already existing node. "
"If that is okay, either discard that input's owner or use graph.clone."
),
):
var3 = op1(var1)
FunctionGraph([var3], [var2], clone=False)

with pytest.raises(ValueError):
with pytest.raises(ValueError, match="No outputs specified"):
var3 = op1(var1)
FunctionGraph([var3], clone=False)

Expand Down