示例#1
0
 def test_custom_new_table(self):
     table = tables.NewTable(buckets=0)
     self.assertEqual(node.Node(triedtable=table).triedtable, table)
示例#2
0
 def test_default_newtable(self):
     self.assertEqual(node.Node().newtable, tables.NewTable())
示例#3
0
文件: node.py 项目: rayween/btclipse
 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
示例#4
0
 def test_custom_buckets(self):
     self.assertEqual(tables.NewTable(buckets=5).buckets, 5)
示例#5
0
 def test_custom_slots(self):
     self.assertEqual(tables.NewTable(slots=2)[0].slots, 2)
示例#6
0
 def test_default_slots(self):
     self.assertEqual(tables.NewTable()[0].slots, 64)
示例#7
0
 def test_default_buckets(self):
     self.assertEqual(tables.NewTable().buckets, 256)