Why errors='replace'?  This will silently throw away information, which seems dangerous in a test.