mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-01 21:50:21 +08:00
Add durations to unittest in 3.12 (#10636)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import sys
|
||||
import unittest.case
|
||||
from _typeshed import OptExcInfo
|
||||
from collections.abc import Callable
|
||||
from typing import Any, TextIO, TypeVar
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_F = TypeVar("_F", bound=Callable[..., Any])
|
||||
_DurationsType: TypeAlias = list[tuple[str, float]]
|
||||
|
||||
STDOUT_LINE: str
|
||||
STDERR_LINE: str
|
||||
@@ -22,6 +25,8 @@ class TestResult:
|
||||
buffer: bool
|
||||
failfast: bool
|
||||
tb_locals: bool
|
||||
if sys.version_info >= (3, 12):
|
||||
collectedDurations: _DurationsType
|
||||
def __init__(self, stream: TextIO | None = None, descriptions: bool | None = None, verbosity: int | None = None) -> None: ...
|
||||
def printErrors(self) -> None: ...
|
||||
def wasSuccessful(self) -> bool: ...
|
||||
@@ -37,3 +42,5 @@ class TestResult:
|
||||
def addExpectedFailure(self, test: unittest.case.TestCase, err: OptExcInfo) -> None: ...
|
||||
def addUnexpectedSuccess(self, test: unittest.case.TestCase) -> None: ...
|
||||
def addSubTest(self, test: unittest.case.TestCase, subtest: unittest.case.TestCase, err: OptExcInfo | None) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def addDuration(self, test: unittest.case.TestCase, elapsed: float) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user