Further updates to ensure Python 3 compatibility across the entire test suite