Port test_mimetools.py to PyUnit and add various tests.

From SF patch #736962.
2 files changed