def test_hostIPv6Address(self):
        """
        When the host passed to L{HostnameEndpoint} is an IPv6 address it is
        wrapped in brackets in the string representation, like in a URI. This
        prevents the colon separating the host from the port from being
        ambiguous.
        """
        endpoint = endpoints.HostnameEndpoint(
            deterministicResolvingReactor(Clock(), []),
            b'::1', 22,
        )

        rep = repr(endpoint)

        self.assertEqual("<HostnameEndpoint [::1]:22>", rep)
        self.assertIs(str, type(rep))

        When the host passed to L{HostnameEndpoint} is an IPv6 address it is
        wrapped in brackets in the string representation, like in a URI. This
        prevents the colon separating the host from the port from being
        ambiguous.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_endpoints.py