|
|
@@ -295,6 +295,7 @@ def encode_dict(x,r): |
|
|
|
encode_func = {} |
|
|
|
encode_func[BencachedType] = encode_bencached |
|
|
|
encode_func[int] = encode_int |
|
|
|
encode_func[bytes] = encode_bytes |
|
|
|
encode_func[str] = encode_string |
|
|
|
encode_func[list] = encode_list |
|
|
|
encode_func[tuple] = encode_list |
|
|
@@ -319,7 +320,7 @@ def test_bencode(): |
|
|
|
assert bencode(12345678901234567890) == b'i12345678901234567890e' |
|
|
|
assert bencode('') == b'0:' |
|
|
|
assert bencode('abc') == b'3:abc' |
|
|
|
assert bencode('1234567890') == b'10:1234567890' |
|
|
|
assert bencode(b'1234567890') == b'10:1234567890' |
|
|
|
assert bencode([]) == b'le' |
|
|
|
assert bencode([1, 2, 3]) == b'li1ei2ei3ee' |
|
|
|
assert bencode([['Alice', 'Bob'], [2, 3]]) == b'll5:Alice3:Bobeli2ei3eee' |
|
|
|