def test_list(self): self.assertEqual(bencode.encode([]), 'le') self.assertEqual(bencode.encode([ ['test', 2], [ ['foo'], [3] ] ]), 'll4:testi2eell3:fooeli3eeee')
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')
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')
def test_int(self): self.assertEqual(bencode.encode(12), 'i12e') self.assertEqual(bencode.encode(-12), 'i-12e') self.assertEqual(bencode.encode(-0), 'i0e')
def test_string(self): self.assertEqual(bencode.encode('test'), '4:test')
def test_list(self): self.assertEqual(bencode.encode([]), 'le') self.assertEqual(bencode.encode([['test', 2], [['foo'], [3]]]), 'll4:testi2eell3:fooeli3eeee')