@@ -2542,55 +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: --disable-bytearray-promotion --disable-memoryview-promotion --strict-equality
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-
2581- [case testEnableBytearrayMemoryviewPromotionStrictEquality]
2582- # flags: --strict-equality
2583- def f(x: bytes, y: bytearray, z: memoryview) -> None:
2584- x == y
2585- y == z
2586- x == z
2587- 97 in x
2588- 97 in y
2589- 97 in z
2590- x in y
2591- x in z
2592- [builtins fixtures/primitives.pyi]
2593-
25942545[case testStrictBytes]
25952546# flags: --strict-bytes
25962547def f(x: bytes) -> None: ...
@@ -2605,23 +2556,6 @@ f(bytearray(b"asdf"))
26052556f(memoryview(b"asdf"))
26062557[builtins fixtures/primitives.pyi]
26072558
2608- [case testStrictBytesDisabledByDefault]
2609- # TODO: probably change this default in Mypy v2.0, with https://github.com/python/mypy/pull/18371
2610- # (this would also obsolete the testStrictBytesEnabledByStrict test, below)
2611- def f(x: bytes) -> None: ...
2612- f(bytearray(b"asdf"))
2613- f(memoryview(b"asdf"))
2614- [builtins fixtures/primitives.pyi]
2615-
2616- [case testStrictBytesEnabledByStrict]
2617- # flags: --strict --disable-error-code type-arg
2618- # The type-arg thing is just work around the primitives.pyi isinstance Tuple not having type parameters,
2619- # which isn't important for this.
2620- def f(x: bytes) -> None: ...
2621- f(bytearray(b"asdf")) # E: Argument 1 to "f" has incompatible type "bytearray"; expected "bytes"
2622- f(memoryview(b"asdf")) # E: Argument 1 to "f" has incompatible type "memoryview"; expected "bytes"
2623- [builtins fixtures/primitives.pyi]
2624-
26252559[case testNoCrashFollowImportsForStubs]
26262560# flags: --config-file tmp/mypy.ini
26272561{**{"x": "y"}}
0 commit comments