Refactor tests and remove Python 'magic'

This pull request removes a lot of Python 'magic'
* Removed Python magic variables.
* Removed Python magic functions.
* Removed references to Python `builtin` types, exceptions, and functions.
* Removed docstrings (i.e. Python comments)

Included is some refactoring where I have extracted the tests for common scopes into a separate test.