Regarding the tests, I don't see tests for the aliases anywhere, so something like:
for alias, codec_name in encodings.aliases.items():
self.assertEqual(codecs.lookup(alias).name, codec_name)
could be added somewhere to check that all the aliases in the dict map to the correct codec.
Well, actually encodings.aliases links to the encoding _module name_, as described in the doc:
""" Encoding Aliases Support
This module is used by the encodings package search function to
map encodings names to module names.
"""
So I've adjusted your snippet according to this, as you can see in the attachment.
I've also slightly changed the imports as pep8 says:
"""
Yes: import os
import sys
No: import sys, os
"""
Anyway, running the test failed for two encodings, there are two bugs there, indeed.
- mcbs has something broken in its imports;
- tactis module is not present.
Since they are really easy to fix, I haven't yet reported to the bugtraker. Let me know what should I do.
Post on
bugs.python.org bug and patch? Any new test specifically for the email module?
--