Add explicit test for check_int_nonzero
This commit is contained in:
parent
ffa6797958
commit
86725847ed
@ -6,7 +6,7 @@ from unittest.mock import MagicMock
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from freqtrade.commands import Arguments
|
from freqtrade.commands import Arguments
|
||||||
from freqtrade.commands.cli_options import check_int_positive
|
from freqtrade.commands.cli_options import check_int_nonzero, check_int_positive
|
||||||
|
|
||||||
|
|
||||||
# Parse common command-line-arguments. Used for all tools
|
# Parse common command-line-arguments. Used for all tools
|
||||||
@ -257,3 +257,23 @@ def test_check_int_positive() -> None:
|
|||||||
|
|
||||||
with pytest.raises(argparse.ArgumentTypeError):
|
with pytest.raises(argparse.ArgumentTypeError):
|
||||||
check_int_positive('DeadBeef')
|
check_int_positive('DeadBeef')
|
||||||
|
|
||||||
|
|
||||||
|
def test_check_int_nonzero() -> None:
|
||||||
|
assert check_int_nonzero('3') == 3
|
||||||
|
assert check_int_nonzero('1') == 1
|
||||||
|
assert check_int_nonzero('100') == 100
|
||||||
|
|
||||||
|
assert check_int_nonzero('-2') == -2
|
||||||
|
|
||||||
|
with pytest.raises(argparse.ArgumentTypeError):
|
||||||
|
check_int_nonzero('0')
|
||||||
|
|
||||||
|
with pytest.raises(argparse.ArgumentTypeError):
|
||||||
|
check_int_nonzero(0)
|
||||||
|
|
||||||
|
with pytest.raises(argparse.ArgumentTypeError):
|
||||||
|
check_int_nonzero('3.5')
|
||||||
|
|
||||||
|
with pytest.raises(argparse.ArgumentTypeError):
|
||||||
|
check_int_nonzero('DeadBeef')
|
||||||
|
Loading…
Reference in New Issue
Block a user