def test_multiple_peers(self): """ Test that a two peer list is decoded correctly. """ self.p = torrent.decode_binary_peers("dddd\x03\xe8dddd\x03\xe8") self.assertEqual(self.p, [('100.100.100.100', 1000), \ ('100.100.100.100', 1000)])
def test_single_peer(self): """ Test that a one peer list is decoded. """ self.p = torrent.decode_binary_peers("dddd\x03\xe8") self.assertEqual(self.p, [("100.100.100.100", 1000)])
def test_zero_peer(self): """ Test that a zero peer list is decoded correctly. """ self.p = torrent.decode_binary_peers([]) self.assertEqual(self.p, [])