def test_dns_async(self): def got_addrinfo(request, code, addrinfo): self.assert_true(addrinfo) def got_nameinfo(request, code, hostname, service): self.assert_equal(service, 'http') uv.getaddrinfo('localhost', 80, callback=got_addrinfo) uv.getnameinfo('127.0.0.1', 80, callback=got_nameinfo) self.loop.run()
def test_dns_sync(self): self.assert_true(uv.getaddrinfo('localhost', 80)) self.assert_equal(uv.getnameinfo('127.0.0.1', 80).service, 'http')