[1.7.x] Fixed assertion from refs #23939 test.

The assertion is different on master due to
393c0e24223c701edeb8ce7dc9d0f852f0c081ad.