Refs #23947 -- Worked around a bug in Python that prevents deprecation warnings from appearing in tests.