def test_custom_new_table(self): table = tables.NewTable(buckets=0) self.assertEqual(node.Node(triedtable=table).triedtable, table)
def test_default_newtable(self): self.assertEqual(node.Node().newtable, tables.NewTable())
def __init__(self, **kwargs): self._newtable = kwargs.get('newtable', tables.NewTable()) self._triedtable = kwargs.get('triedtable', tables.TriedTable()) self._outpeers = kwargs.get('outpeers', 8) self._peers = [None for _ in range(self.outpeers)] self._len = 0
def test_custom_buckets(self): self.assertEqual(tables.NewTable(buckets=5).buckets, 5)
def test_custom_slots(self): self.assertEqual(tables.NewTable(slots=2)[0].slots, 2)
def test_default_slots(self): self.assertEqual(tables.NewTable()[0].slots, 64)
def test_default_buckets(self): self.assertEqual(tables.NewTable().buckets, 256)