Download tests/test_gradio_binary.py from build-small-hackathon/color-ux-access: direct link, hf CLI and curl.
- Browser
- Download file 626 Bytes
-
https://huggingface.co/spaces/build-small-hackathon/color-ux-access/resolve/main/tests/test_gradio_binary.py
- Command line
-
hf download hf://spaces/build-small-hackathon/color-ux-access/tests/test_gradio_binary.py
-
curl -L -o test_gradio_binary.py https://huggingface.co/spaces/build-small-hackathon/color-ux-access/resolve/main/tests/test_gradio_binary.py
626 Bytes
| """ | |
| RED test — verify Gradio File with type="binary" passes bytes, not file objects. | |
| Regression test for: "Bytes object has no attribute read" error when uploading JPEG. | |
| Gradio's binary File type returns raw bytes, not a file-like object. | |
| """ | |
| import sys, os, pathlib | |
| # Read modal_app.py source directly (can't import a Modal Stub in test env) | |
| source_file = pathlib.Path(os.path.join(os.path.dirname(__file__), "..", "color_ux_access", "modal_app.py")) | |
| source = source_file.read_text() | |
| assert "isinstance(file_obj, bytes)" in source, \ | |
| "analyze_screenshot should check isinstance(file_obj, bytes) before calling .read()" |