()
| 335 | |
| 336 | |
| 337 | def test_environ_builder_unicode_file_mix(): |
| 338 | for use_tempfile in False, True: |
| 339 | f = FileStorage(BytesIO(rb"\N{SNOWMAN}"), "snowman.txt") |
| 340 | d = MultiDict(dict(f=f, s="\N{SNOWMAN}")) |
| 341 | stream, length, boundary = stream_encode_multipart( |
| 342 | d, use_tempfile, threshold=150 |
| 343 | ) |
| 344 | assert isinstance(stream, BytesIO) != use_tempfile |
| 345 | |
| 346 | _, form, files = parse_form_data( |
| 347 | { |
| 348 | "wsgi.input": stream, |
| 349 | "CONTENT_LENGTH": str(length), |
| 350 | "CONTENT_TYPE": f'multipart/form-data; boundary="{boundary}"', |
| 351 | } |
| 352 | ) |
| 353 | assert form["s"] == "\N{SNOWMAN}" |
| 354 | assert files["f"].name == "f" |
| 355 | assert files["f"].filename == "snowman.txt" |
| 356 | assert files["f"].read() == rb"\N{SNOWMAN}" |
| 357 | stream.close() |
| 358 | files["f"].close() |
| 359 | |
| 360 | |
| 361 | def test_environ_builder_empty_file(): |
nothing calls this directly
no test coverage detected