switch code blocks to ipython
make tests into modules for nose2 compatibility