add more tests for the line monitor
rework the tests so that it is easier to check what is expected
minor pep8 and pyflakes cleanup
make sure that we set the right trace function back.