Status: PASSED 2026-03-16
Tests filter_text(ctype, content_bytes) in list_email_attachments.py. Pure function, no I/O. All cases assert exact expected output, not just type.
PASS — all 6 cases passed
1. application/json — valid JSON
Input b'{"b": 2, "a": 1}'. Expected: json.dumps({"b": 2, "a": 1}, indent=2). Asserts exact pretty-printed string equality.
2. application/json — invalid JSON
Input b'{ not valid json !!!'. Expected: '{ not valid json !!!' (raw decode, no exception).
3. text/html — tags stripped
Input b'<p>Hello <b>world</b></p>'. Expected exact output: 'Hello world'.
4. text/plain
Input b'plain text content'. Expected exact: 'plain text content'.
5. text/csv
Input b'name,age\nAlice,30\nBob,25'. Expected exact: 'name,age\nAlice,30\nBob,25' — decoded, no transformation.
6. Binary types → None
image/png, application/pdf, application/octet-stream all return None.
cd ~/py/envoy && python3 test_filter_text.py