Skip to content

Commit 16d1cbe

Browse files
authored
improve error message in function graph tests (#108)
Co-authored-by: Maxim Kochurov <[email protected]>
1 parent d9fe197 commit 16d1cbe

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/graph/test_fg.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,23 @@ def test_validate_inputs(self):
4242
var1 = op1()
4343
var2 = op2()
4444

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

48-
with pytest.raises(TypeError):
48+
with pytest.raises(TypeError, match="'Variable' object is not reversible"):
4949
FunctionGraph([var1], var2)
5050

51-
with pytest.raises(ValueError):
51+
with pytest.raises(
52+
ValueError,
53+
match=(
54+
"One of the provided inputs is the output of an already existing node. "
55+
"If that is okay, either discard that input's owner or use graph.clone."
56+
),
57+
):
5258
var3 = op1(var1)
5359
FunctionGraph([var3], [var2], clone=False)
5460

55-
with pytest.raises(ValueError):
61+
with pytest.raises(ValueError, match="No outputs specified"):
5662
var3 = op1(var1)
5763
FunctionGraph([var3], clone=False)
5864

0 commit comments

Comments
 (0)