def test_writingToIPv6OnIPv4RaisesInvalidAddressError(self):
        """
        Writing to an IPv6 address on an IPv4 socket will raise an
        L{InvalidAddressError}.
        """
        reactor = self.buildReactor()
        port = self.getListeningPort(
            reactor, DatagramProtocol(), interface="127.0.0.1")
        self.assertRaises(
            error.InvalidAddressError, port.write, 'spam', ('::1', 1))

        Writing to an IPv6 address on an IPv4 socket will raise an
        L{InvalidAddressError}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_udp.py