Skip to content

Commit

Permalink
fix: tests (#5)
Browse files Browse the repository at this point in the history
* test: more examples for enum

* test: use bounded dates
  • Loading branch information
bdura authored Apr 19, 2024
1 parent bbb117b commit d674c32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/test_from_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Defcon(enum.Enum):

EXAMPLES = [
("5", Defcon.FIVE),
# ("3", Defcon.THREE),
# ("1", Defcon.ONE),
("3", Defcon.THREE),
("1", Defcon.ONE),
]

parser = from_enum(Defcon)
Expand Down
9 changes: 7 additions & 2 deletions tests/test_from_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ def datetime_parser(stream: Stream[str]) -> datetime:
return datetime(year, month, day)


@given(st.datetimes())
def test_generate(dt: datetime):
@given(
st.datetimes(
min_value=datetime(1000, 1, 1),
max_value=datetime(9999, 12, 31),
)
)
def test_datetime_parser_from_stream(dt: datetime):
dt = datetime(dt.year, dt.month, dt.day)
text = dt.strftime("%Y-%m-%d")
assert datetime_parser.parse(text) == dt

0 comments on commit d674c32

Please sign in to comment.