pep8
added tests for write and mode set