Safely map integers

This commit is contained in:
544146
2023-09-16 22:56:47 +01:00
parent 8b8846c082
commit eb3fa7a6db
666 changed files with 599680 additions and 599648 deletions
+19
View File
@@ -0,0 +1,19 @@
from __future__ import annotations
import pytest
from model.dancerush import safe_int
@pytest.mark.parametrize(
'input_value, expected_output', [
('42', 42),
('0', 0),
('-100', -100),
(None, None),
('abc', None),
([1, 2, 3], None),
],
)
def test_safe_int(input_value, expected_output):
assert safe_int(input_value) == expected_output