def test_remove_contact_removes_from_replacement_cache(self):
        parent_node_id = '0xdeadbeef'
        r = RoutingTable(parent_node_id)
        contact1 = PeerNode(PUBLIC_KEY, '192.168.0.1', 9999, self.version, 0)
        contact1.network_id = '0xa'
        contact2 = PeerNode(PUBLIC_KEY, '192.168.0.2', 9999, self.version, 0)
        contact2.network_id = '0xb'
        r.add_contact(contact1)
        r.add_contact(contact2)
        r._replacement_cache[0] = []
        r._replacement_cache[0].append(contact2)
        # Sanity check
        self.assertEqual(len(r._buckets[0]), 2)
        self.assertEqual(len(r._replacement_cache[0]), 1)

        r.remove_contact('0xb', forced=True)
        self.assertEqual(len(r._buckets[0]), 1)
        self.assertNotIn(contact2, r._replacement_cache[0])
Ensures that if a contact is signalled to be removed it is also cleared
dataset/ETHPy150Open ntoll/p4p2p/test/dht/test_routingtable.py/TestRoutingTable.test_remove_contact_removes_from_replacement_cache