bpo-41338: Fix DeprecationWarning in tests (GH-21542)

3 files changed