Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-usielski committed Jul 12, 2024
1 parent dea1dc0 commit 996fc8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions moler/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ def convert_to_number(value, none_if_cannot_convert: bool = False):
except ValueError:
if none_if_cannot_convert:
return None
else:
if none_if_cannot_convert:
return None
return value


Expand Down
8 changes: 4 additions & 4 deletions test/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ def test_convert_to_number_str():
def test_convert_to_number_str_none():
from moler.helpers import convert_to_number
expected = "not a number"
result = convert_to_number(expected)
assert expected == result
result = convert_to_number(expected, True)
assert result is None
result1 = convert_to_number(expected, False)
assert expected == result1
result2 = convert_to_number(expected, True)
assert result2 is None


def test_escape_cursors():
Expand Down

0 comments on commit 996fc8c

Please sign in to comment.