tests/__init__.py
raw| 1 | """Helpers for the tests.""" |
| 2 | |
| 3 | from collections.abc import AsyncGenerator |
| 4 | from pathlib import Path |
| 5 | |
| 6 | |
| 7 | def load_responses(filename: str) -> str: |
| 8 | """Load a responses.""" |
| 9 | path = Path(__file__).parent / "responses" / filename |
| 10 | return path.read_text() |
| 11 | |
| 12 | |
| 13 | async def upload_stream() -> AsyncGenerator[bytes, None]: |
| 14 | """Generate a stream of bytes.""" |
| 15 | yield b"Hello, " |
| 16 | yield b"world!" |