def test_chr_get_nodes(self): hosts = [ ("127.0.0.1", "cache0"), ("127.0.0.1", "cache1"), ("127.0.0.1", "cache2"), ] hashring = ConsistentHashRing(hosts) node = hashring.get_nodes('hosts.worker1.cpu') expected = [ ("127.0.0.1", "cache2"), ("127.0.0.1", "cache0"), ("127.0.0.1", "cache1"), ] self.assertEqual(node, expected)