-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check_if_number util function handles None, and add test (#257)
- Loading branch information
1 parent
c3bf5c9
commit 17dc928
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Test the utils module""" | ||
|
||
import pytest | ||
|
||
from fmu.dataio import _utils as utils | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"value, result", | ||
[ | ||
(None, None), | ||
("0", 0), | ||
("1", 1), | ||
("1.0", 1.0), | ||
("0.0", 0.0), | ||
("-1", -1), | ||
("-1.0", -1.0), | ||
("-999", -999), | ||
("-999.12345678", -999.12345678), | ||
("9999999999999999", 9999999999999999), | ||
("abc", "abc"), | ||
(False, False), | ||
(True, True), | ||
], | ||
) | ||
def test_check_if_number(value, result): | ||
assert utils.check_if_number(value) == result |