|
|
@@ -106,7 +106,7 @@ def bdecode(x, sloppy = 0): |
|
|
|
raise ValueError("bad bencoded data") |
|
|
|
return r |
|
|
|
|
|
|
|
def test_bdecode(): |
|
|
|
def test_bdecode(): # pragma: no cover |
|
|
|
try: |
|
|
|
bdecode(b'0:0:') |
|
|
|
assert 0 |
|
|
@@ -327,7 +327,7 @@ def test_bencode(): |
|
|
|
assert bencode({}) == b'de' |
|
|
|
assert bencode({'age': 25, 'eyes': 'blue'}) == b'd3:agei25e4:eyes4:bluee' |
|
|
|
assert bencode({'spam.mp3': {'author': 'Alice', 'length': 100000}}) == b'd8:spam.mp3d6:author5:Alice6:lengthi100000eee' |
|
|
|
try: |
|
|
|
try: # pragma: no cover |
|
|
|
bencode({1: 'foo'}) |
|
|
|
assert 0 |
|
|
|
except (ValueError, AssertionError): |
|
|
@@ -342,7 +342,7 @@ class _TestCases(unittest.TestCase): |
|
|
|
def test_bdecode(self): |
|
|
|
test_bdecode() |
|
|
|
|
|
|
|
try: |
|
|
|
try: #pragma: no cover |
|
|
|
import psyco |
|
|
|
psyco.bind(bdecode) |
|
|
|
psyco.bind(bencode) |
|
|
|