Skip to content

Commit e64fb9f

Browse files
authored
Fix failing stubgen tests (#16779)
1 parent e28925d commit e64fb9f

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

.github/workflows/test_stubgenc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'misc/test-stubgenc.sh'
1111
- 'mypy/stubgenc.py'
1212
- 'mypy/stubdoc.py'
13+
- 'mypy/stubutil.py'
1314
- 'test-data/stubgen/**'
1415

1516
permissions:

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ repos:
99
rev: 23.9.1 # must match test-requirements.txt
1010
hooks:
1111
- id: black
12+
exclude: '^(test-data/)'
1213
- repo: https://github.com/astral-sh/ruff-pre-commit
1314
rev: v0.1.4 # must match test-requirements.txt
1415
hooks:

test-data/pybind11_fixtures/expected_stubs_no_docs/pybind11_fixtures/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
from . import demo as demo
3-
from typing import List, Optional, Tuple, overload
3+
from typing import List, Tuple, overload
44

55
class StaticMethods:
66
def __init__(self, *args, **kwargs) -> None: ...
@@ -21,7 +21,7 @@ class TestStruct:
2121
def field_readonly(self) -> int: ...
2222

2323
def func_incomplete_signature(*args, **kwargs): ...
24-
def func_returning_optional() -> Optional[int]: ...
24+
def func_returning_optional() -> int | None: ...
2525
def func_returning_pair() -> Tuple[int, float]: ...
2626
def func_returning_path() -> os.PathLike: ...
2727
def func_returning_vector() -> List[float]: ...

test-data/pybind11_fixtures/expected_stubs_with_docs/pybind11_fixtures/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
from . import demo as demo
3-
from typing import List, Optional, Tuple, overload
3+
from typing import List, Tuple, overload
44

55
class StaticMethods:
66
def __init__(self, *args, **kwargs) -> None:
@@ -42,7 +42,7 @@ class TestStruct:
4242

4343
def func_incomplete_signature(*args, **kwargs):
4444
"""func_incomplete_signature() -> dummy_sub_namespace::HasNoBinding"""
45-
def func_returning_optional() -> Optional[int]:
45+
def func_returning_optional() -> int | None:
4646
"""func_returning_optional() -> Optional[int]"""
4747
def func_returning_pair() -> Tuple[int, float]:
4848
"""func_returning_pair() -> Tuple[int, float]"""

0 commit comments

Comments
 (0)