Greatly enhanced test.py (fixes #6)