Beispiel #1
0
 def test_string_encoding(self):
     """tests string encoding"""
     strs = Bencoder.encode("announce")
     self.assertEqual(strs, "8:announce")
Beispiel #2
0
 def test_list_encoding(self):
     """tests list encoding"""
     strs = Bencoder.encode([1, 2])
     self.assertEqual(strs, "li1ei2ee")
Beispiel #3
0
 def test_dict_encoding(self):
     """tests dictionary encoding"""
     strs = Bencoder.encode(dict(a="1"))
     self.assertEqual(strs, "d1:a1:1e")
Beispiel #4
0
 def test_integer_encoding(self):
     """tests integer encoding"""
     strs = Bencoder.encode(1)
     self.assertEqual(strs, "i1e")