Fixed formtools tests with Python 2

Fixes #19905 again.