Skip to content

Commit e703388

Browse files
committed
more test
1 parent 0b7abe9 commit e703388

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

mypy/checker.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8924,10 +8924,7 @@ def reduce_and_conditional_type_maps(ms: list[TypeMap], *, use_meet: bool) -> Ty
89248924
return result
89258925

89268926

8927-
BUILTINS_CUSTOM_EQ_CHECKS: Final = {
8928-
"_collections_abc.dict_keys",
8929-
"_collections_abc.dict_items",
8930-
}
8927+
BUILTINS_CUSTOM_EQ_CHECKS: Final = {"_collections_abc.dict_keys", "_collections_abc.dict_items"}
89318928

89328929

89338930
def has_custom_eq_checks(t: Type) -> bool:

test-data/unit/pythoneval.test

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,28 +2217,40 @@ _testDictOrUnionEdgeCases.py:10: note: Revealed type is "dict[str, dict[str, ...
22172217
# flags: --strict-equality --warn-unreachable
22182218
from typing import Mapping, AbstractSet
22192219

2220-
def f1(x: Mapping[str, int]) -> None:
2220+
def f1(x: Mapping[str, int], y: dict[str, int]) -> None:
22212221
if isinstance(x, dict):
22222222
reveal_type(x)
22232223

2224+
if x == y:
2225+
reveal_type(x)
2226+
reveal_type(y)
2227+
22242228
if x == {}:
22252229
reveal_type(x)
22262230

2227-
def f2(x: AbstractSet[int]) -> None:
2231+
def f2(x: AbstractSet[int], y: set[int]) -> None:
22282232
if isinstance(x, set):
22292233
reveal_type(x)
22302234

2235+
if x == y:
2236+
reveal_type(x)
2237+
reveal_type(y)
2238+
22312239
if x == set():
22322240
reveal_type(x)
22332241

2234-
def f3(x: frozenset[str], y: set[str]):
2242+
def f3(x: frozenset[int], y: set[int]):
22352243
if x == y:
22362244
reveal_type(x)
22372245
reveal_type(y)
22382246
[out]
22392247
_testNarrowingMappingAndAbstractSet.py:6: note: Revealed type is "dict[Any, Any]"
22402248
_testNarrowingMappingAndAbstractSet.py:9: note: Revealed type is "typing.Mapping[str, int]"
2241-
_testNarrowingMappingAndAbstractSet.py:13: note: Revealed type is "set[Any]"
2242-
_testNarrowingMappingAndAbstractSet.py:16: note: Revealed type is "typing.AbstractSet[int]"
2243-
_testNarrowingMappingAndAbstractSet.py:20: note: Revealed type is "frozenset[str]"
2244-
_testNarrowingMappingAndAbstractSet.py:21: note: Revealed type is "set[str]"
2249+
_testNarrowingMappingAndAbstractSet.py:10: note: Revealed type is "dict[str, int]"
2250+
_testNarrowingMappingAndAbstractSet.py:13: note: Revealed type is "typing.Mapping[str, int]"
2251+
_testNarrowingMappingAndAbstractSet.py:17: note: Revealed type is "set[Any]"
2252+
_testNarrowingMappingAndAbstractSet.py:20: note: Revealed type is "typing.AbstractSet[int]"
2253+
_testNarrowingMappingAndAbstractSet.py:21: note: Revealed type is "set[int]"
2254+
_testNarrowingMappingAndAbstractSet.py:24: note: Revealed type is "typing.AbstractSet[int]"
2255+
_testNarrowingMappingAndAbstractSet.py:28: note: Revealed type is "frozenset[int]"
2256+
_testNarrowingMappingAndAbstractSet.py:29: note: Revealed type is "set[int]"

0 commit comments

Comments
 (0)