@@ -2542,42 +2542,6 @@ x: int = "" # E: Incompatible types in assignment (expression has type "str", v
25422542# flags: --hide-error-codes
25432543x: int = "" # E: Incompatible types in assignment (expression has type "str", variable has type "int")
25442544
2545- [case testDisableBytearrayPromotion]
2546- # flags: --disable-bytearray-promotion --strict-equality --warn-unreachable
2547- def f(x: bytes) -> None: ...
2548- f(bytearray(b"asdf")) # E: Argument 1 to "f" has incompatible type "bytearray"; expected "bytes"
2549- f(memoryview(b"asdf"))
2550- ba = bytearray(b"")
2551- if ba == b"":
2552- f(ba) # E: Argument 1 to "f" has incompatible type "bytearray"; expected "bytes"
2553- if b"" == ba:
2554- f(ba) # E: Argument 1 to "f" has incompatible type "bytearray"; expected "bytes"
2555- if ba == bytes():
2556- f(ba) # E: Argument 1 to "f" has incompatible type "bytearray"; expected "bytes"
2557- if bytes() == ba:
2558- f(ba) # E: Argument 1 to "f" has incompatible type "bytearray"; expected "bytes"
2559- [builtins fixtures/primitives.pyi]
2560-
2561- [case testDisableMemoryviewPromotion]
2562- # flags: --disable-memoryview-promotion
2563- def f(x: bytes) -> None: ...
2564- f(bytearray(b"asdf"))
2565- f(memoryview(b"asdf")) # E: Argument 1 to "f" has incompatible type "memoryview"; expected "bytes"
2566- [builtins fixtures/primitives.pyi]
2567-
2568- [case testDisableBytearrayMemoryviewPromotionStrictEquality]
2569- # flags: --strict-equality --strict-bytes
2570- def f(x: bytes, y: bytearray, z: memoryview) -> None:
2571- x == y
2572- y == z
2573- x == z
2574- 97 in x
2575- 97 in y
2576- 97 in z
2577- x in y
2578- x in z
2579- [builtins fixtures/primitives.pyi]
2580-
25812545[case testStrictBytes]
25822546# flags: --strict-bytes
25832547def f(x: bytes) -> None: ...
@@ -2592,23 +2556,6 @@ f(bytearray(b"asdf"))
25922556f(memoryview(b"asdf"))
25932557[builtins fixtures/primitives.pyi]
25942558
2595- [case testStrictBytesDisabledByDefault]
2596- # TODO: probably change this default in Mypy v2.0, with https://github.com/python/mypy/pull/18371
2597- # (this would also obsolete the testStrictBytesEnabledByStrict test, below)
2598- def f(x: bytes) -> None: ...
2599- f(bytearray(b"asdf"))
2600- f(memoryview(b"asdf"))
2601- [builtins fixtures/primitives.pyi]
2602-
2603- [case testStrictBytesEnabledByStrict]
2604- # flags: --strict --disable-error-code type-arg
2605- # The type-arg thing is just work around the primitives.pyi isinstance Tuple not having type parameters,
2606- # which isn't important for this.
2607- def f(x: bytes) -> None: ...
2608- f(bytearray(b"asdf")) # E: Argument 1 to "f" has incompatible type "bytearray"; expected "bytes"
2609- f(memoryview(b"asdf")) # E: Argument 1 to "f" has incompatible type "memoryview"; expected "bytes"
2610- [builtins fixtures/primitives.pyi]
2611-
26122559[case testNoCrashFollowImportsForStubs]
26132560# flags: --config-file tmp/mypy.ini
26142561{**{"x": "y"}}
0 commit comments