File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,20 +77,26 @@ def test_container_root_is_not_allowed_at_low_depth():
7777 pack (_nested_list (1 ), max_depth = 1 )
7878
7979
80+ @pytest .mark .skipif (
81+ sys .version_info < (3 , 12 ), reason = "Test limits accurate on Python 3.12 or higher"
82+ )
8083def test_recursion_limit_pack ():
8184 limit = sys .getrecursionlimit () - get_stack_depth ()
8285 obj = _nested_list (limit )
8386
84- # assert obj
85- # pack(obj[0])
87+ assert obj
88+ pack (obj [0 ])
8689
8790 with pytest .raises (RecursionError , match = "maximum recursion depth exceeded" ):
8891 pack (obj )
8992
9093
94+ @pytest .mark .skipif (
95+ sys .version_info < (3 , 12 ), reason = "Test limits accurate on Python 3.12 or higher"
96+ )
9197def test_recursion_limit_unpack ():
9298 previous_limit = sys .getrecursionlimit ()
93- with recursion_limit (previous_limit + get_stack_depth () + 5 ):
99+ with recursion_limit (previous_limit + get_stack_depth () + 1 ):
94100 data = pack (_nested_list (previous_limit ))
95101 with pytest .raises (RecursionError , match = "maximum recursion depth exceeded" ):
96102 unpack (data )
You can’t perform that action at this time.
0 commit comments