refactoring machine_test.py
solwing import problems and PEP8 cosmetic changes