Move test_py_htm to nupic.core and refactor test

Fixes #281