File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -44,18 +44,18 @@ def test_ordered_dict(benchmark):
4444 assert list (bdecode (b'd2:ke2:va2:kci2ee' ).keys ()) == [b'ke' , b'kc' ]
4545
4646
47- def test_encode_complex (benchmark ):
47+ def test_encode_complex ():
4848 od = dict ()
4949 od [b'KeyA' ] = [b'listitemA' , {b'k' : b'v' }, 3 ]
5050 od [b'KeyB' ] = {b'k' : b'v' }
5151 od [b'KeyC' ] = 3
5252 od [b'KeyD' ] = b'AString'
5353 expected_result = b'd4:KeyAl9:listitemAd1:k1:vei3ee4:KeyBd1:k1:ve4:KeyCi3e4:KeyD7:AStringe'
54- assert benchmark ( bdecode , expected_result ) == od
54+ assert bdecode ( expected_result ) == od
5555
5656
57- def test_decode_debian_torrent (benchmark ):
57+ def test_decode_debian_torrent ():
5858 with open (TORRENT_PATH , "rb" ) as f :
59- torrent = benchmark ( bdecode , f .read ())
59+ torrent = bdecode ( f .read ())
6060 assert torrent [b'announce' ] == b'http://bttracker.debian.org:6969/announce'
6161 assert torrent [b'comment' ] == b'"Debian CD from cdimage.debian.org"'
Original file line number Diff line number Diff line change @@ -58,25 +58,25 @@ def test_encode_dict_subclass(benchmark):
5858 class AAA (dict ):
5959 pass
6060
61- od = dict ()
61+ od = AAA ()
6262 od ['ka' ] = 'va'
6363 od ['kb' ] = 2
6464 assert benchmark (bencode , od ) == b'd2:ka2:va2:kbi2ee'
6565
6666
67- def test_encode_complex (benchmark ):
67+ def test_encode_complex ():
6868 od = dict ()
6969 od ['KeyA' ] = ['listitemA' , {'k' : 'v' }, 3 ]
7070 od ['KeyB' ] = {'k' : 'v' }
7171 od ['KeyC' ] = 3
7272 od ['KeyD' ] = 'AString'
7373 expected_result = b'd4:KeyAl9:listitemAd1:k1:vei3ee4:KeyBd1:k1:ve4:KeyCi3e4:KeyD7:AStringe'
74- assert benchmark ( bencode , od ) == expected_result
74+ assert bencode ( od ) == expected_result
7575
7676
77- def test_infohash (benchmark ):
77+ def test_infohash ():
7878 import hashlib
7979 with open (TORRENT_PATH , "rb" ) as f :
8080 torrent = bdecode (f .read ())
81- infohash = hashlib .sha1 (benchmark ( bencode , torrent [b'info' ])).hexdigest ()
81+ infohash = hashlib .sha1 (bencode ( torrent [b'info' ])).hexdigest ()
8282 assert infohash == "4194e473d6c49630e1c6247d6716076809bb96ae"
You can’t perform that action at this time.
0 commit comments