Skip to content

Commit

Permalink
chore: Don't use pytz datetimes with hypothesis for now
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-pl committed Oct 1, 2024
1 parent 34049fb commit 04d6f91
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
25 changes: 12 additions & 13 deletions lodkit/testing_tools/xsd_type_strategy_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
import re

from hypothesis import strategies as st
from hypothesis.extra.pytz import timezones
from hypothesis.provisional import urls
from hypothesis.strategies._internal.strategies import SearchStrategy
from rdflib import URIRef, XSD


_fill = lambda x: str(x).zfill(2)
_base_date_time: SearchStrategy = st.datetimes(timezones=timezones())
# _fill = lambda x: str(x).zfill(2)
# _base_date_time: SearchStrategy = st.datetimes(timezones=timezones())


def get_xsd_type_strategies(
Expand All @@ -29,16 +28,16 @@ def get_xsd_type_strategies(
XSD.nonNegativeInteger: st.integers(min_value=0),
XSD.nonPositiveInteger: st.integers(max_value=0),
XSD.positiveInteger: st.integers(min_value=1),
XSD.dateTime: _base_date_time.map(lambda dt: dt.isoformat()),
XSD.time: _base_date_time.map(lambda dt: str(dt.time())),
XSD.date: _base_date_time.map(lambda dt: str(dt.date())),
XSD.gDay: _base_date_time.map(lambda dt: f"---{_fill(dt.day)}"),
XSD.gMonth: _base_date_time.map(lambda dt: f"--{_fill(dt.month)}"),
XSD.gYear: _base_date_time.map(lambda dt: str(dt.year)),
XSD.gMonthDay: _base_date_time.map(
lambda dt: f"--{_fill(dt.month)}-{_fill(dt.day)}"
),
XSD.gYearMonth: _base_date_time.map(lambda dt: f"{dt.year}-{dt.month}"),
# XSD.dateTime: _base_date_time.map(lambda dt: dt.isoformat()),
# XSD.time: _base_date_time.map(lambda dt: str(dt.time())),
# XSD.date: _base_date_time.map(lambda dt: str(dt.date())),
# XSD.gDay: _base_date_time.map(lambda dt: f"---{_fill(dt.day)}"),
# XSD.gMonth: _base_date_time.map(lambda dt: f"--{_fill(dt.month)}"),
# XSD.gYear: _base_date_time.map(lambda dt: str(dt.year)),
# XSD.gMonthDay: _base_date_time.map(
# lambda dt: f"--{_fill(dt.month)}-{_fill(dt.day)}"
# ),
# XSD.gYearMonth: _base_date_time.map(lambda dt: f"{dt.year}-{dt.month}"),
# language
}

Expand Down
15 changes: 8 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ readme = "README.md"
python = "^3.11"
loguru = "^0.7.2"
rdflib = "^7.0.0"
hypothesis = "^6.103.3"
langcodes = "^3.4.0"
typeguard = "^4.3.0"
pytz = "^2024.2"
hypothesis = {extras = ["pytz"], version = "^6.112.2"}


[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 04d6f91

Please sign in to comment.