fixup: remove remove unused alias in code
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import contextmanager
|
||||
from decimal import Decimal
|
||||
from fractions import Fraction
|
||||
@@ -6,7 +8,6 @@ from math import sqrt
|
||||
import operator
|
||||
from operator import eq
|
||||
from operator import ne
|
||||
from typing import Optional
|
||||
|
||||
from _pytest.pytester import Pytester
|
||||
from _pytest.python_api import _recursive_sequence_map
|
||||
@@ -415,9 +416,7 @@ class TestApprox:
|
||||
(-1e100, -1e100),
|
||||
],
|
||||
)
|
||||
def test_negative_tolerance(
|
||||
self, rel: Optional[float], abs: Optional[float]
|
||||
) -> None:
|
||||
def test_negative_tolerance(self, rel: float | None, abs: float | None) -> None:
|
||||
# Negative tolerances are not allowed.
|
||||
with pytest.raises(ValueError):
|
||||
1.1 == approx(1, rel, abs)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import textwrap
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
|
||||
import _pytest._code
|
||||
from _pytest.config import ExitCode
|
||||
@@ -1103,7 +1104,7 @@ class TestTracebackCutting:
|
||||
|
||||
tb = None
|
||||
try:
|
||||
ns: Dict[str, Any] = {}
|
||||
ns: dict[str, Any] = {}
|
||||
exec("def foo(): raise ValueError", ns)
|
||||
ns["foo"]()
|
||||
except ValueError:
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
@@ -4460,7 +4462,7 @@ def test_fixture_named_request(pytester: Pytester) -> None:
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
"*'request' is a reserved word for fixtures, use another name:",
|
||||
" *test_fixture_named_request.py:6",
|
||||
" *test_fixture_named_request.py:8",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from __future__ import annotations
|
||||
|
||||
from _pytest._code import getfslineno
|
||||
from _pytest.fixtures import getfixturemarker
|
||||
from _pytest.pytester import Pytester
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from __future__ import annotations
|
||||
|
||||
import dataclasses
|
||||
import itertools
|
||||
import re
|
||||
@@ -8,11 +10,7 @@ from typing import Any
|
||||
from typing import cast
|
||||
from typing import Dict
|
||||
from typing import Iterator
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from typing import Sequence
|
||||
from typing import Tuple
|
||||
from typing import Union
|
||||
|
||||
import hypothesis
|
||||
from hypothesis import strategies
|
||||
@@ -35,7 +33,7 @@ class TestMetafunc:
|
||||
# on the funcarg level, so we don't need a full blown
|
||||
# initialization.
|
||||
class FuncFixtureInfoMock:
|
||||
name2fixturedefs: Dict[str, List[fixtures.FixtureDef[object]]] = {}
|
||||
name2fixturedefs: dict[str, list[fixtures.FixtureDef[object]]] = {}
|
||||
|
||||
def __init__(self, names):
|
||||
self.names_closure = names
|
||||
@@ -101,7 +99,7 @@ class TestMetafunc:
|
||||
def __repr__(self):
|
||||
return "Exc(from_gen)"
|
||||
|
||||
def gen() -> Iterator[Union[int, None, Exc]]:
|
||||
def gen() -> Iterator[int | None | Exc]:
|
||||
yield 0
|
||||
yield None
|
||||
yield Exc()
|
||||
@@ -346,7 +344,7 @@ class TestMetafunc:
|
||||
|
||||
option = "disable_test_id_escaping_and_forfeit_all_rights_to_community_support"
|
||||
|
||||
values: List[Tuple[str, Any, str]] = [
|
||||
values: list[tuple[str, Any, str]] = [
|
||||
("ação", MockConfig({option: True}), "ação"),
|
||||
("ação", MockConfig({option: False}), "a\\xe7\\xe3o"),
|
||||
]
|
||||
@@ -516,7 +514,7 @@ class TestMetafunc:
|
||||
def test_idmaker_idfn(self) -> None:
|
||||
"""#351"""
|
||||
|
||||
def ids(val: object) -> Optional[str]:
|
||||
def ids(val: object) -> str | None:
|
||||
if isinstance(val, Exception):
|
||||
return repr(val)
|
||||
return None
|
||||
@@ -579,7 +577,7 @@ class TestMetafunc:
|
||||
|
||||
option = "disable_test_id_escaping_and_forfeit_all_rights_to_community_support"
|
||||
|
||||
values: List[Tuple[Any, str]] = [
|
||||
values: list[tuple[Any, str]] = [
|
||||
(MockConfig({option: True}), "ação"),
|
||||
(MockConfig({option: False}), "a\\xe7\\xe3o"),
|
||||
]
|
||||
@@ -617,7 +615,7 @@ class TestMetafunc:
|
||||
|
||||
option = "disable_test_id_escaping_and_forfeit_all_rights_to_community_support"
|
||||
|
||||
values: List[Tuple[Any, str]] = [
|
||||
values: list[tuple[Any, str]] = [
|
||||
(MockConfig({option: True}), "ação"),
|
||||
(MockConfig({option: False}), "a\\xe7\\xe3o"),
|
||||
]
|
||||
@@ -1748,9 +1746,9 @@ class TestMetafuncFunctionalAuto:
|
||||
self, pytester: Pytester, monkeypatch
|
||||
) -> None:
|
||||
"""Integration test for (#3941)"""
|
||||
class_fix_setup: List[object] = []
|
||||
class_fix_setup: list[object] = []
|
||||
monkeypatch.setattr(sys, "class_fix_setup", class_fix_setup, raising=False)
|
||||
func_fix_setup: List[object] = []
|
||||
func_fix_setup: list[object] = []
|
||||
monkeypatch.setattr(sys, "func_fix_setup", func_fix_setup, raising=False)
|
||||
|
||||
pytester.makepyfile(
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from _pytest.pytester import Pytester
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user