Start implementing a unit test suite
Fix a couple of stupid mistakes revealed by the test suite

(using "return" in place of "raise" in EnumSafeDict)