Commit 52d8743
tests: adjust mime type expectations for .rtf (#22)
The test checks the mime type of .rtf filename. The check is based
on stdlib's `mimetypes.guess_type(name, strict=False)` which in
turn depends on provider of mime types mapping.
CPython's default mapping for rtf:
https://github.com/python/cpython/blob/3.14/Lib/mimetypes.py#L650
https://github.com/python/cpython/blob/3.14/Lib/mimetypes.py#L678-L683
$ python3 -c 'import mimetypes; mimetypes.knownfiles=[]; mimetypes.init(); print(mimetypes.types_map[".rtf"])'
text/rtf
`mimetypes` tries next providers of mime data by default:
$ python3 -c 'import mimetypes; print(mimetypes.knownfiles)'
['/etc/mime.types', '/etc/httpd/mime.types', '/etc/httpd/conf/mime.types', '/etc/apache/mime.types', '/etc/apache2/mime.types', '/usr/local/etc/httpd/conf/mime.types', '/usr/local/lib/netscape/mime.types', '/usr/local/etc/httpd/conf/mime.types', '/usr/local/etc/mime.types']
With installed /etc/mime.types (mailcap):
$ python3 -c 'import mimetypes; mimetypes.init(); print(mimetypes.types_map[".rtf"])'
application/rtf
According to https://www.iana.org/assignments/media-types/media-types.xhtml
both are possible.
Fixes: #21
Signed-off-by: Stanislav Levin <[email protected]>
Co-authored-by: Michael Howitz <[email protected]>1 parent 5dab094 commit 52d8743
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
0 commit comments