Fix failing test on Python 2.7.6.
cherry pick test fix in 276fea31d4a3da3cea34b8d368b71e174c2658a5