Skip to content

Commit

Permalink
Fix pjson tests on newer Python versions (#564)
Browse files Browse the repository at this point in the history
* Fix draw strategy for os.stat_result in test_pjson.py

* Use correct deserialization in ambiguous type hint test

---------

Co-authored-by: Jake Jepson <[email protected]>
  • Loading branch information
alchzh and Jepson2k authored Jan 9, 2025
1 parent 8e15fc5 commit c819f3b
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ def iterable_strategy(draw, type_hint):
@composite
def os_stat_result_strategy(draw, _type_hint):
"""
os.stat_result instances can be generated as tuples of size 10. They most likely won't be valid
but it doesn't matter here.
os.stat_result instances can be generated as tuples of size 10.
"""
return draw(tuples(*[integer_strategy()] * 10))
return os.stat_result(draw(tuples(*[integer_strategy()] * 10)))


@composite
Expand Down Expand Up @@ -270,7 +269,7 @@ def test_interval_tree_serialization(obj: IntervalTree, _test_serialize_deserial
"json_obj,type_hint",
[
([1, 2], List),
({1: 2}, Dict),
([(1, 2)], Dict),
],
)
def test_from_pjson_ambiguous_type_hints(
Expand Down

0 comments on commit c819f3b

Please sign in to comment.