From 18c73ceb907e7d9ce2c9252a48e2a13bbb36e0f3 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Tue, 10 Dec 2019 00:22:11 +0300 Subject: [PATCH] Add tests for the last commit --- tests/test_utils.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index f7bb12799..feba1ed59 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -764,3 +764,25 @@ def test_hyperopt_show(mocker, capsys, hyperopt_results): start_hyperopt_show(pargs) captured = capsys.readouterr() assert " 10/12" in captured.out + + args = [ + "hyperopt-show", + "--best", + "-n", "-4" + ] + pargs = get_args(args) + pargs['config'] = None + with pytest.raises(OperationalException, + match="The index of the epoch to show should be greater than -4."): + start_hyperopt_show(pargs) + + args = [ + "hyperopt-show", + "--best", + "-n", "4" + ] + pargs = get_args(args) + pargs['config'] = None + with pytest.raises(OperationalException, + match="The index of the epoch to show should be less than 4."): + start_hyperopt_show(pargs)