Fixed PEP8 errors and made minor simplifications.
Fixed error causing the cached _schema to not be updated.

- This was causing conflicts between tests, causing some to fail
  by that.
Improved code of tests (PEP8 and repeated code).