move test code to test.py