Skip to content

Commit 0227606

Browse files
Fix tests for Python 3.14.0a7 (#13527)
Authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com> Co-authored-by: James Addison <55152140+jayaddison@users.noreply.github.com>
1 parent 5a73bf6 commit 0227606

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

tests/test_extensions/test_ext_autodoc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,10 +938,14 @@ def test_autodoc_special_members(app):
938938
}
939939
if sys.version_info >= (3, 13, 0, 'alpha', 5):
940940
options['exclude-members'] = '__static_attributes__,__firstlineno__'
941+
if sys.version_info >= (3, 14, 0, 'alpha', 7):
942+
ann_attr_name = '__annotations_cache__'
943+
else:
944+
ann_attr_name = '__annotations__'
941945
actual = do_autodoc(app, 'class', 'target.Class', options)
942946
assert list(filter(lambda l: '::' in l, actual)) == [
943947
'.. py:class:: Class(arg)',
944-
' .. py:attribute:: Class.__annotations__',
948+
f' .. py:attribute:: Class.{ann_attr_name}',
945949
' .. py:attribute:: Class.__dict__',
946950
' .. py:method:: Class.__init__(arg)',
947951
' .. py:attribute:: Class.__module__',

tests/test_extensions/test_ext_autodoc_configs.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,10 @@ def test_autodoc_type_aliases(app: SphinxTestApp) -> None:
13481348
# default
13491349
options = {'members': None}
13501350
actual = do_autodoc(app, 'module', 'target.autodoc_type_aliases', options)
1351+
if sys.version_info >= (3, 14, 0, 'alpha', 7):
1352+
attr2_typeinfo = ()
1353+
else:
1354+
attr2_typeinfo = (' :type: int',)
13511355
assert list(actual) == [
13521356
'',
13531357
'.. py:module:: target.autodoc_type_aliases',
@@ -1368,7 +1372,7 @@ def test_autodoc_type_aliases(app: SphinxTestApp) -> None:
13681372
'',
13691373
' .. py:attribute:: Foo.attr2',
13701374
' :module: target.autodoc_type_aliases',
1371-
' :type: int',
1375+
*attr2_typeinfo,
13721376
'',
13731377
' docstring',
13741378
'',
@@ -1421,6 +1425,10 @@ def test_autodoc_type_aliases(app: SphinxTestApp) -> None:
14211425
'io.StringIO': 'my.module.StringIO',
14221426
}
14231427
actual = do_autodoc(app, 'module', 'target.autodoc_type_aliases', options)
1428+
if sys.version_info >= (3, 14, 0, 'alpha', 7):
1429+
attr2_typeinfo = ()
1430+
else:
1431+
attr2_typeinfo = (' :type: myint',)
14241432
assert list(actual) == [
14251433
'',
14261434
'.. py:module:: target.autodoc_type_aliases',
@@ -1441,7 +1449,7 @@ def test_autodoc_type_aliases(app: SphinxTestApp) -> None:
14411449
'',
14421450
' .. py:attribute:: Foo.attr2',
14431451
' :module: target.autodoc_type_aliases',
1444-
' :type: myint',
1452+
*attr2_typeinfo,
14451453
'',
14461454
' docstring',
14471455
'',

0 commit comments

Comments
 (0)