Skip to content

Commit 1861342

Browse files
committed
more py39 typing
1 parent fbee318 commit 1861342

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

hypothesis-python/tests/ghostwriter/test_ghostwriter.py

+8-19
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,12 @@
1515
import socket
1616
import unittest
1717
import unittest.mock
18+
from collections.abc import KeysView, Sequence, Sized, ValuesView
1819
from decimal import Decimal
1920
from pathlib import Path
2021
from textwrap import dedent
2122
from types import FunctionType, ModuleType
22-
from typing import (
23-
Any,
24-
FrozenSet,
25-
KeysView,
26-
List,
27-
Match,
28-
Pattern,
29-
Sequence,
30-
Set,
31-
Sized,
32-
Union,
33-
ValuesView,
34-
)
23+
from typing import Any, Union
3524

3625
import attr
3726
import click
@@ -112,7 +101,7 @@ def test_ghostwriter_exploits_arguments_with_enum_defaults():
112101
test()
113102

114103

115-
def timsort(seq: Sequence[int]) -> List[int]:
104+
def timsort(seq: Sequence[int]) -> list[int]:
116105
return sorted(seq)
117106

118107

@@ -150,19 +139,19 @@ def takes_values(x: ValuesView[int]) -> None:
150139
pass
151140

152141

153-
def takes_match(x: Match[bytes]) -> None:
142+
def takes_match(x: re.Match[bytes]) -> None:
154143
pass
155144

156145

157-
def takes_pattern(x: Pattern[str]) -> None:
146+
def takes_pattern(x: re.Pattern[str]) -> None:
158147
pass
159148

160149

161150
def takes_sized(x: Sized) -> None:
162151
pass
163152

164153

165-
def takes_frozensets(a: FrozenSet[int], b: FrozenSet[int]) -> None:
154+
def takes_frozensets(a: frozenset[int], b: frozenset[int]) -> None:
166155
pass
167156

168157

@@ -232,7 +221,7 @@ def test_inference_from_defaults_and_none_booleans_reprs_not_just_and_sampled_fr
232221
assert "@given(foo=st.none(), bar=st.booleans())" in source_code
233222

234223

235-
def hopefully_hashable(foo: Set[Decimal]):
224+
def hopefully_hashable(foo: set[Decimal]):
236225
pass
237226

238227

@@ -273,7 +262,7 @@ def from_json(cls, obj: str) -> Union[dict, list]:
273262
return json.loads(obj)
274263

275264
@staticmethod
276-
def static_sorter(seq: Sequence[int]) -> List[int]:
265+
def static_sorter(seq: Sequence[int]) -> list[int]:
277266
return sorted(seq)
278267

279268

0 commit comments

Comments
 (0)