Skip to content

Commit

Permalink
fix python <3.10 tests
Browse files Browse the repository at this point in the history
add support for python 3.12
  • Loading branch information
drkane committed Sep 27, 2023
1 parent 9873a55 commit 2d38305
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion src/ixbrlparse/components/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ixtNumDotDecimal(ixbrlFormat): # noqa: N801

class ixtDateFormat(ixbrlFormat): # noqa: N801
format_names: Tuple[str, ...] = ()
date_format: Tuple[str, ...] | str = "%Y-%m-%d"
date_format: Union[Tuple[str, ...], str] = "%Y-%m-%d"

def _get_date_formats(self) -> Sequence[str]:
if isinstance(self.date_format, str):
Expand Down
2 changes: 1 addition & 1 deletion src/ixbrlparse/components/nonnumeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(
self.context = context
self.format: Optional[ixbrlFormat] = None
self.text: Optional[str] = value
self.value: Optional[int | float | date | None | str] = value
self.value: Optional[Union[str, int, float, None, date]] = value
if isinstance(format_, str) and format_ != "" and self.text is not None:
try:
self.format = get_format(format_)(format_=format_)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_plugins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Type
from typing import List, Type, Union

import pytest

Expand All @@ -13,7 +13,7 @@ def test_using_test_plugin():
class FlurgFormat(ixbrlFormat):
format_names = ("flurg",)

def parse_value(self, value: str | int | float) -> str: # noqa: ARG002
def parse_value(self, value: Union[str, int, float]) -> str: # noqa: ARG002
return "flurg"

class TestPlugin:
Expand All @@ -36,7 +36,7 @@ def test_registering_duplicate_plugin():
class FlurgFormat(ixbrlFormat):
format_names = ("ixt:zerodash",)

def parse_value(self, value: str | int | float) -> str: # noqa: ARG002
def parse_value(self, value: Union[str, int, float]) -> str: # noqa: ARG002
return "flurg"

class TestPlugin:
Expand Down

0 comments on commit 2d38305

Please sign in to comment.