Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Oct 11, 2024
1 parent d8d0737 commit 0a3a759
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
26 changes: 7 additions & 19 deletions pyanalyze/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ def capybara(
assert_is_value(omega, t_str_int | KnownValue(None))
assert_is_value(empty, SequenceValue(tuple, []))

@skip_before((3, 9))
@assert_passes()
def test_builtin_tuples(self):
from collections.abc import Iterable
Expand Down Expand Up @@ -412,7 +411,6 @@ def capybara(
for elt in returner():
assert_is_value(elt, t_str_int)

@skip_before((3, 9))
def test_builtin_tuples_string(self):
self.assert_passes(
"""
Expand Down Expand Up @@ -536,14 +534,12 @@ def capybara(x: Type[str], y: "Type[int]"):
assert_is_value(x, SubclassValue(TypedValue(str)))
assert_is_value(y, SubclassValue(TypedValue(int)))

@skip_before((3, 9))
@assert_passes()
def test_lowercase_type(self):
def capybara(x: type[str], y: "type[int]"):
assert_is_value(x, SubclassValue(TypedValue(str)))
assert_is_value(y, SubclassValue(TypedValue(int)))

@skip_before((3, 9))
@assert_passes()
def test_generic_alias(self):
from queue import Queue
Expand All @@ -564,7 +560,6 @@ def capybara(x: list[int], y: tuple[int, str], z: tuple[int, ...]) -> None:
)
assert_is_value(z, GenericValue(tuple, [TypedValue(int)]))

@skip_before((3, 9))
def test_pep604(self):
self.assert_passes(
"""
Expand All @@ -581,18 +576,15 @@ def caller():
)

@skip_before((3, 10))
@assert_passes()
def test_pep604_runtime(self):
self.assert_passes(
"""
def capybara(x: int | None, y: int | str) -> None:
assert_is_value(x, MultiValuedValue([TypedValue(int), KnownValue(None)]))
assert_is_value(y, MultiValuedValue([TypedValue(int), TypedValue(str)]))
def capybara(x: int | None, y: int | str) -> None:
assert_is_value(x, MultiValuedValue([TypedValue(int), KnownValue(None)]))
assert_is_value(y, MultiValuedValue([TypedValue(int), TypedValue(str)]))

def caller():
capybara(1, 2)
capybara(None, "x")
"""
)
def caller():
capybara(1, 2)
capybara(None, "x")

@assert_passes()
def test_stringified_ops(self):
Expand Down Expand Up @@ -688,7 +680,6 @@ def capybara(
),
)

@skip_before((3, 9))
@assert_passes()
def test_typing(self):
import collections.abc
Expand Down Expand Up @@ -730,7 +721,6 @@ def capybara(
),
)

@skip_before((3, 9))
@assert_passes()
def test_genericalias_nested_class(self):
def capybara():
Expand Down Expand Up @@ -785,7 +775,6 @@ def capybara(
assert_is_value(takes_seq([int("1")]), TypedValue(int))
assert_is_value(two_args(1, "x"), TypedValue(float))

@skip_before((3, 9))
@assert_passes()
def test_abc_callable(self):
from collections.abc import Callable, Sequence
Expand Down Expand Up @@ -1961,7 +1950,6 @@ def capybara(
) -> set: # E: missing_generic_parameters
return {1}

@skip_before((3, 9))
@assert_passes()
def test_with_pep_585(self):
def capybara(
Expand Down
1 change: 0 additions & 1 deletion pyanalyze/test_typevar.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def capybara() -> None:
assert_is_value(mktemp(suffix="s"), KnownValue("s"))
assert_is_value(mktemp("p", "s"), KnownValue("p") | KnownValue("s"))

@skip_before((3, 9))
@assert_passes()
def test_generic_constructor(self):
from typing import Generic, TypeVar
Expand Down

0 comments on commit 0a3a759

Please sign in to comment.