Fix mode value error

- fix helper message when bad ``mode`` is specified, tried to catch AttributeError, should catch KeyError.
- move existing tests/*.py files into tests/functional/
- add new test (pytest), tests/unit/test_xmodem.py