Skip to content

Commit

Permalink
Merge pull request #41 from vin0110/parse_error
Browse files Browse the repository at this point in the history
remove white space from value before parsing
  • Loading branch information
drkane authored Jul 12, 2024
2 parents d0fc770 + b4b4c73 commit 9acc9f0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-beta.1"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion src/ixbrlparse/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.1"
__version__ = "0.9.2"
2 changes: 1 addition & 1 deletion src/ixbrlparse/components/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ixtNumWordsEn(ixbrlFormat): # noqa: N801

def parse_value(self, value: Union[str, int, float]) -> Optional[Union[int, float]]:
if isinstance(value, str):
value = value.lower()
value = value.strip().lower()
if value in ("no", "none"):
return 0
from word2number import w2n
Expand Down
3 changes: 3 additions & 0 deletions tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def test_date_formats(dateclass, datestring, expecteddate, errordate):
def test_ixtnumwordsen():
f = ixtNumWordsEn("format")
assert f.parse_value("no") == 0
assert f.parse_value("none") == 0
assert f.parse_value("none ") == 0
assert f.parse_value("eighty-five") == 85.0
assert f.parse_value("seven hundred and eighty-five") == 785.0

with pytest.raises(ValueError):
assert f.parse_value("blurdy-burg") is None
Expand Down

0 comments on commit 9acc9f0

Please sign in to comment.