Skip to content

Commit

Permalink
more py39 typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Oct 9, 2024
1 parent fbee318 commit 1861342
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions hypothesis-python/tests/ghostwriter/test_ghostwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,12 @@
import socket
import unittest
import unittest.mock
from collections.abc import KeysView, Sequence, Sized, ValuesView
from decimal import Decimal
from pathlib import Path
from textwrap import dedent
from types import FunctionType, ModuleType
from typing import (
Any,
FrozenSet,
KeysView,
List,
Match,
Pattern,
Sequence,
Set,
Sized,
Union,
ValuesView,
)
from typing import Any, Union

import attr
import click
Expand Down Expand Up @@ -112,7 +101,7 @@ def test_ghostwriter_exploits_arguments_with_enum_defaults():
test()


def timsort(seq: Sequence[int]) -> List[int]:
def timsort(seq: Sequence[int]) -> list[int]:
return sorted(seq)


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


def takes_match(x: Match[bytes]) -> None:
def takes_match(x: re.Match[bytes]) -> None:
pass


def takes_pattern(x: Pattern[str]) -> None:
def takes_pattern(x: re.Pattern[str]) -> None:
pass


def takes_sized(x: Sized) -> None:
pass


def takes_frozensets(a: FrozenSet[int], b: FrozenSet[int]) -> None:
def takes_frozensets(a: frozenset[int], b: frozenset[int]) -> None:
pass


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


def hopefully_hashable(foo: Set[Decimal]):
def hopefully_hashable(foo: set[Decimal]):
pass


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

@staticmethod
def static_sorter(seq: Sequence[int]) -> List[int]:
def static_sorter(seq: Sequence[int]) -> list[int]:
return sorted(seq)


Expand Down

0 comments on commit 1861342

Please sign in to comment.