Skip to content

Commit ea69ae5

Browse files
Copilotxadupre
andauthored
test: cover sankey input validation errors
Agent-Logs-Url: https://github.com/sdpython/teachpyx/sessions/68526f45-813e-4c5a-959d-84afb8a8544a Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
1 parent b0b770b commit ea69ae5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

_unittests/ut_faq/test_faq_python.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ def test_graph_sankey(self):
3636
self.assertEqual(ax.get_title(), "flux")
3737
self.assertEqual(len(diagrams), 1)
3838

39+
def test_graph_sankey_errors(self):
40+
with self.assertRaisesRegex(ValueError, "at least two values"):
41+
graph_sankey([1])
42+
with self.assertRaisesRegex(ValueError, "must be 0"):
43+
graph_sankey([1, -0.5])
44+
with self.assertRaisesRegex(ValueError, "same length"):
45+
graph_sankey([1, -1], labels=["only_one"])
46+
with self.assertRaisesRegex(ValueError, "same length"):
47+
graph_sankey([1, -1], orientations=[0, 1, -1])
48+
3949

4050
if __name__ == "__main__":
4151
unittest.main()

0 commit comments

Comments
 (0)