Adjust for change to documention change of next in Python 3.12

The signature of the builtin isn't actually changing in Python 3.12,
however its documentation has changed.
This commit is contained in:
Peter Law
2023-09-17 18:24:59 +01:00
parent 770cdade00
commit a60fdba1d4
2 changed files with 7 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
from textwrap import dedent from textwrap import dedent
import sys
import math import math
from collections import Counter from collections import Counter
from datetime import datetime from datetime import datetime
@@ -26,7 +27,10 @@ def test_builtin_loading(inference_state):
assert not from_name.py__doc__() # It's a stub assert not from_name.py__doc__() # It's a stub
def test_next_docstr(inference_state): def test_next_docstr(inference_state, environment):
if environment.version_info[:2] != sys.version_info[:2]:
pytest.skip()
next_ = compiled.builtin_from_name(inference_state, 'next') next_ = compiled.builtin_from_name(inference_state, 'next')
assert next_.tree_node is not None assert next_.tree_node is not None
assert next_.py__doc__() == '' # It's a stub assert next_.py__doc__() == '' # It's a stub

View File

@@ -13,7 +13,8 @@ from ..helpers import get_example_dir
'code, sig, names, op, version', [ 'code, sig, names, op, version', [
('import math; math.cos', 'cos(x, /)', ['x'], ge, (3, 6)), ('import math; math.cos', 'cos(x, /)', ['x'], ge, (3, 6)),
('next', 'next(iterator, default=None, /)', ['iterator', 'default'], ge, (3, 6)), ('next', 'next(iterator, default=None, /)', ['iterator', 'default'], lt, (3, 12)),
('next', 'next()', [], ge, (3, 12)),
('str', "str(object='', /) -> str", ['object'], ge, (3, 6)), ('str', "str(object='', /) -> str", ['object'], ge, (3, 6)),