def test_resolverGivenStr(self):
        """
        L{ThreadedResolver.getHostByName} is passed L{str}, encoded using IDNA
        if required.
        """
        calls = []

        @implementer(IResolverSimple)
        class FakeResolver(object):
            def getHostByName(self, name, timeouts=()):
                calls.append(name)
                return Deferred()

        class JustEnoughReactor(ReactorBase):
            def installWaker(self):
                pass

        fake = FakeResolver()
        reactor = JustEnoughReactor()
        reactor.installResolver(fake)
        rec = FirstOneWins(Deferred())
        reactor.nameResolver.resolveHostName(
            rec, u"example.example")
        reactor.nameResolver.resolveHostName(
            rec, "example.example")
        reactor.nameResolver.resolveHostName(
            rec, u"v\xe4\xe4ntynyt.example")
        reactor.nameResolver.resolveHostName(
            rec, u"\u0440\u0444.example")
        reactor.nameResolver.resolveHostName(
            rec, "xn----7sbb4ac0ad0be6cf.xn--p1ai")

        self.assertEqual(len(calls), 5)
        self.assertEqual(list(map(type, calls)), [str]*5)
        self.assertEqual("example.example", calls[0])
        self.assertEqual("example.example", calls[1])
        self.assertEqual("xn--vntynyt-5waa.example", calls[2])
        self.assertEqual("xn--p1ai.example", calls[3])
        self.assertEqual("xn----7sbb4ac0ad0be6cf.xn--p1ai", calls[4])

        L{ThreadedResolver.getHostByName} is passed L{str}, encoded using IDNA
        if required.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_base.py