mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Fix doctest for 3.13 (#12625)
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import sys
|
||||
import types
|
||||
import unittest
|
||||
from _typeshed import ExcInfo
|
||||
from collections.abc import Callable
|
||||
from typing import Any, NamedTuple
|
||||
from typing_extensions import TypeAlias
|
||||
from typing import Any, ClassVar, NamedTuple
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
__all__ = [
|
||||
"register_optionflag",
|
||||
@@ -41,9 +42,22 @@ __all__ = [
|
||||
"debug",
|
||||
]
|
||||
|
||||
class TestResults(NamedTuple):
|
||||
failed: int
|
||||
attempted: int
|
||||
# MyPy errors on conditionals within named tuples.
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
class TestResults(NamedTuple):
|
||||
def __new__(cls, failed: int, attempted: int, *, skipped: int = 0) -> Self: ... # type: ignore[misc]
|
||||
skipped: int
|
||||
failed: int
|
||||
attempted: int
|
||||
_fields: ClassVar = ("failed", "attempted") # type: ignore[misc]
|
||||
__match_args__ = ("failed", "attempted") # type: ignore[misc]
|
||||
__doc__: None # type: ignore[misc]
|
||||
|
||||
else:
|
||||
class TestResults(NamedTuple):
|
||||
failed: int
|
||||
attempted: int
|
||||
|
||||
OPTIONFLAGS_BY_NAME: dict[str, int]
|
||||
|
||||
@@ -134,6 +148,8 @@ class DocTestRunner:
|
||||
original_optionflags: int
|
||||
tries: int
|
||||
failures: int
|
||||
if sys.version_info >= (3, 13):
|
||||
skips: int
|
||||
test: DocTest
|
||||
def __init__(self, checker: OutputChecker | None = None, verbose: bool | None = None, optionflags: int = 0) -> None: ...
|
||||
def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user