mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 14:01:55 +08:00
[alt] typing: accept buffers in IO.write (#9861)
Co-authored-by: JelleZijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
21
test_cases/stdlib/typing/check_io.py
Normal file
21
test_cases/stdlib/typing/check_io.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import mmap
|
||||
from typing import IO, AnyStr
|
||||
|
||||
|
||||
def check_write(io_bytes: IO[bytes], io_str: IO[str], io_anystr: IO[AnyStr], any_str: AnyStr, buf: mmap.mmap) -> None:
|
||||
io_bytes.write(b"")
|
||||
io_bytes.write(buf)
|
||||
io_bytes.write("") # type: ignore
|
||||
io_bytes.write(any_str) # type: ignore
|
||||
|
||||
io_str.write(b"") # type: ignore
|
||||
io_str.write(buf) # type: ignore
|
||||
io_str.write("")
|
||||
io_str.write(any_str) # type: ignore
|
||||
|
||||
io_anystr.write(b"") # type: ignore
|
||||
io_anystr.write(buf) # type: ignore
|
||||
io_anystr.write("") # type: ignore
|
||||
io_anystr.write(any_str)
|
||||
Reference in New Issue
Block a user