Not my wheelhouse, but the tests feel a bit like anti-helpers to me—that is, they share so little code that you might as well just make separate functions for ipv4 and ipv6.
I'm happy for them to stay as they are - I don't think we'd gain much by rewriting them.