From 1aaf9716074caba67ff8c19ad75ea90b8b5fc4e3 Mon Sep 17 00:00:00 2001 From: Maxim Kochurov Date: Mon, 12 Dec 2022 10:06:38 +0300 Subject: [PATCH] improve error message in function graph tests --- tests/graph/test_fg.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/graph/test_fg.py b/tests/graph/test_fg.py index da86abff22..bf3fb4f89c 100644 --- a/tests/graph/test_fg.py +++ b/tests/graph/test_fg.py @@ -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"): 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)