added some tests for magic.py