Beispiel #1
0
 def test_list(self):
     self.assertEqual(bencode.encode([]), 'le')
     self.assertEqual(bencode.encode([
         ['test', 2], [
             ['foo'], [3]
         ]
     ]), 'll4:testi2eell3:fooeli3eeee')
Beispiel #2
0
 def test_dict(self):
     self.assertEqual(bencode.encode({}), 'de')
     self.assertEqual(
         bencode.encode({
             'test': 12,
             'foo': ['bar', {
                 'test': ['again', 12]
             }]
         }), 'd3:fool3:bard4:testl5:againi12eeee4:testi12ee')
Beispiel #3
0
 def test_dict(self):
     self.assertEqual(bencode.encode({}), 'de')
     self.assertEqual(bencode.encode({
         'test': 12,
         'foo': [
             'bar',
             {'test': ['again', 12]}
         ]
     }), 'd3:fool3:bard4:testl5:againi12eeee4:testi12ee')
Beispiel #4
0
 def test_int(self):
     self.assertEqual(bencode.encode(12), 'i12e')
     self.assertEqual(bencode.encode(-12), 'i-12e')
     self.assertEqual(bencode.encode(-0), 'i0e')
Beispiel #5
0
 def test_string(self):
     self.assertEqual(bencode.encode('test'), '4:test')
Beispiel #6
0
 def test_list(self):
     self.assertEqual(bencode.encode([]), 'le')
     self.assertEqual(bencode.encode([['test', 2], [['foo'], [3]]]),
                      'll4:testi2eell3:fooeli3eeee')
Beispiel #7
0
 def test_int(self):
     self.assertEqual(bencode.encode(12), 'i12e')
     self.assertEqual(bencode.encode(-12), 'i-12e')
     self.assertEqual(bencode.encode(-0), 'i0e')
Beispiel #8
0
 def test_string(self):
     self.assertEqual(bencode.encode('test'), '4:test')