Fixed tests introduced in previous commit on Python 2. Refs #20557.