diff --git a/freqtrade/arguments.py b/freqtrade/arguments.py index 327915b61..5afa8fa06 100644 --- a/freqtrade/arguments.py +++ b/freqtrade/arguments.py @@ -405,7 +405,7 @@ class Arguments(object): raise Exception('Incorrect syntax for timerange "%s"' % text) @staticmethod - def check_int_positive(value) -> int: + def check_int_positive(value: str) -> int: try: uint = int(value) if uint <= 0: diff --git a/freqtrade/tests/test_arguments.py b/freqtrade/tests/test_arguments.py index 455f3dbc6..ecd108b5e 100644 --- a/freqtrade/tests/test_arguments.py +++ b/freqtrade/tests/test_arguments.py @@ -187,13 +187,17 @@ def test_testdata_dl_options() -> None: def test_check_int_positive() -> None: - assert Arguments.check_int_positive(2) == 2 - assert Arguments.check_int_positive(6) == 6 - with pytest.raises(argparse.ArgumentTypeError): - Arguments.check_int_positive(-6) - assert Arguments.check_int_positive(2.5) == 2 assert Arguments.check_int_positive("3") == 3 + assert Arguments.check_int_positive("1") == 1 + assert Arguments.check_int_positive("100") == 100 + + with pytest.raises(argparse.ArgumentTypeError): + Arguments.check_int_positive("-2") + + with pytest.raises(argparse.ArgumentTypeError): + Arguments.check_int_positive("0") + with pytest.raises(argparse.ArgumentTypeError): Arguments.check_int_positive("3.5")