@@ -679,6 +679,10 @@ def test_autodoc_typehints_signature(app):
679
679
type_o = "~typing.Any | None"
680
680
else :
681
681
type_o = "~typing.Any"
682
+ if sys .version_info [:2 ] >= (3 , 13 ):
683
+ type_ppp = "pathlib._local.PurePosixPath"
684
+ else :
685
+ type_ppp = "pathlib.PurePosixPath"
682
686
683
687
options = {"members" : None ,
684
688
"undoc-members" : None }
@@ -703,7 +707,7 @@ def test_autodoc_typehints_signature(app):
703
707
'' ,
704
708
'.. py:data:: CONST3' ,
705
709
' :module: target.typehints' ,
706
- ' :type: ~pathlib.PurePosixPath ' ,
710
+ f ' :type: ~{ type_ppp } ' ,
707
711
" :value: PurePosixPath('/a/b/c')" ,
708
712
'' ,
709
713
' docstring' ,
@@ -726,7 +730,7 @@ def test_autodoc_typehints_signature(app):
726
730
'' ,
727
731
' .. py:attribute:: Math.CONST3' ,
728
732
' :module: target.typehints' ,
729
- ' :type: ~pathlib.PurePosixPath ' ,
733
+ f ' :type: ~{ type_ppp } ' ,
730
734
" :value: PurePosixPath('/a/b/c')" ,
731
735
'' ,
732
736
'' ,
@@ -748,7 +752,7 @@ def test_autodoc_typehints_signature(app):
748
752
'' ,
749
753
' .. py:property:: Math.path' ,
750
754
' :module: target.typehints' ,
751
- ' :type: ~pathlib.PurePosixPath ' ,
755
+ f ' :type: ~{ type_ppp } ' ,
752
756
'' ,
753
757
'' ,
754
758
' .. py:property:: Math.prop' ,
@@ -773,7 +777,7 @@ def test_autodoc_typehints_signature(app):
773
777
'' ,
774
778
' docstring' ,
775
779
'' ,
776
- " alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath `)" ,
780
+ f " alias of TypeVar('T', bound=\\ :py:class:`~{ type_ppp } `)" ,
777
781
'' ,
778
782
'' ,
779
783
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
@@ -802,6 +806,10 @@ def test_autodoc_typehints_signature(app):
802
806
@pytest .mark .sphinx ('html' , testroot = 'ext-autodoc' ,
803
807
confoverrides = {'autodoc_typehints' : "none" })
804
808
def test_autodoc_typehints_none (app ):
809
+ if sys .version_info [:2 ] >= (3 , 13 ):
810
+ type_ppp = "pathlib._local.PurePosixPath"
811
+ else :
812
+ type_ppp = "pathlib.PurePosixPath"
805
813
options = {"members" : None ,
806
814
"undoc-members" : None }
807
815
actual = do_autodoc (app , 'module' , 'target.typehints' , options )
@@ -887,7 +895,7 @@ def test_autodoc_typehints_none(app):
887
895
'' ,
888
896
' docstring' ,
889
897
'' ,
890
- " alias of TypeVar('T', bound=\\ :py:class:`~pathlib.PurePosixPath `)" ,
898
+ f " alias of TypeVar('T', bound=\\ :py:class:`~{ type_ppp } `)" ,
891
899
'' ,
892
900
'' ,
893
901
'.. py:function:: complex_func(arg1, arg2, arg3=None, *args, **kwargs)' ,
@@ -1417,7 +1425,10 @@ def test_autodoc_typehints_format_fully_qualified(app):
1417
1425
type_o = "typing.Any | None"
1418
1426
else :
1419
1427
type_o = "typing.Any"
1420
-
1428
+ if sys .version_info [:2 ] >= (3 , 13 ):
1429
+ type_ppp = "pathlib._local.PurePosixPath"
1430
+ else :
1431
+ type_ppp = "pathlib.PurePosixPath"
1421
1432
options = {"members" : None ,
1422
1433
"undoc-members" : None }
1423
1434
actual = do_autodoc (app , 'module' , 'target.typehints' , options )
@@ -1441,7 +1452,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
1441
1452
'' ,
1442
1453
'.. py:data:: CONST3' ,
1443
1454
' :module: target.typehints' ,
1444
- ' :type: pathlib.PurePosixPath ' ,
1455
+ f ' :type: { type_ppp } ' ,
1445
1456
" :value: PurePosixPath('/a/b/c')" ,
1446
1457
'' ,
1447
1458
' docstring' ,
@@ -1464,7 +1475,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
1464
1475
'' ,
1465
1476
' .. py:attribute:: Math.CONST3' ,
1466
1477
' :module: target.typehints' ,
1467
- ' :type: pathlib.PurePosixPath ' ,
1478
+ f ' :type: { type_ppp } ' ,
1468
1479
" :value: PurePosixPath('/a/b/c')" ,
1469
1480
'' ,
1470
1481
'' ,
@@ -1486,7 +1497,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
1486
1497
'' ,
1487
1498
' .. py:property:: Math.path' ,
1488
1499
' :module: target.typehints' ,
1489
- ' :type: pathlib.PurePosixPath ' ,
1500
+ f ' :type: { type_ppp } ' ,
1490
1501
'' ,
1491
1502
'' ,
1492
1503
' .. py:property:: Math.prop' ,
@@ -1511,7 +1522,7 @@ def test_autodoc_typehints_format_fully_qualified(app):
1511
1522
'' ,
1512
1523
' docstring' ,
1513
1524
'' ,
1514
- " alias of TypeVar('T', bound=\\ :py:class:`pathlib.PurePosixPath `)" ,
1525
+ f " alias of TypeVar('T', bound=\\ :py:class:`{ type_ppp } `)" ,
1515
1526
'' ,
1516
1527
'' ,
1517
1528
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
0 commit comments