def test_writingToHostnameRaisesInvalidAddressError(self):
        """
        Writing to a hostname instead of an IP address will raise an
        L{InvalidAddressError}.
        """
        reactor = self.buildReactor()
        port = self.getListeningPort(reactor, DatagramProtocol())
        self.assertRaises(
            error.InvalidAddressError,
            port.write, 'spam', ('example.invalid', 1))

        Writing to a hostname instead of an IP address will raise an
        L{InvalidAddressError}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_udp.py