Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(12)  |  Call(12)  |  Derive(0)  |  Import(0)

src/d/a/Dandelion-Message-Service-HEAD/dandelionpy/dandelion/test/service_test.py   Dandelion-Message-Service(Download)
 
        # We should get the only available node
        ip, port = d.acquire_node()
        self.assertEqual(ip, "127.0.0.1")
        self.assertEqual(port, 1234)
 
        # Now we can acquire it again and hand it back again
        ip, port = d.acquire_node()
        self.assertEqual(ip, "127.0.0.1")
        self.assertEqual(port, 1234)
        # The out-of-sync case
        d.add_node("127.0.0.1", 1234)
        ip, port = d.acquire_node()
        d.remove_node("127.0.0.1", 1234)
        self.assertRaises(dandelion.discoverer.DiscovererException, d.release_node, ip, port, True)
        # Not pinned (default)
        d.add_node("127.0.0.1", 1234)
        ip, port = d.acquire_node()
        self.assertEqual(ip, "127.0.0.1")
        self.assertEqual(port, 1234)
        # Pinned node
        d.add_node("127.0.0.1", 1234, pin=True)
        ip, port = d.acquire_node()
        d.release_node(ip, port, False) # Simulate failed sync (not automatically removed)
        ip, port = d.acquire_node()