Fix test_query for python3.

Python's hash is not guaranteed to result in the same value in different
runs because of the salt added to them.