Fix some tests for Python compatibility