Adjust check_int_positive tests
This commit is contained in:
parent
7bbe8b2483
commit
469c0b6a55
@ -405,7 +405,7 @@ class Arguments(object):
|
|||||||
raise Exception('Incorrect syntax for timerange "%s"' % text)
|
raise Exception('Incorrect syntax for timerange "%s"' % text)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_int_positive(value) -> int:
|
def check_int_positive(value: str) -> int:
|
||||||
try:
|
try:
|
||||||
uint = int(value)
|
uint = int(value)
|
||||||
if uint <= 0:
|
if uint <= 0:
|
||||||
|
@ -187,13 +187,17 @@ def test_testdata_dl_options() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def test_check_int_positive() -> 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("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):
|
with pytest.raises(argparse.ArgumentTypeError):
|
||||||
Arguments.check_int_positive("3.5")
|
Arguments.check_int_positive("3.5")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user