Browse Source

add bencode tests to run automaticaly, no cover unused func

main
John-Mark Gurney 2 years ago
parent
commit
729f22e431
2 changed files with 11 additions and 1 deletions
  1. +9
    -1
      ui/medashare/btv/bencode.py
  2. +2
    -0
      ui/medashare/tests.py

+ 9
- 1
ui/medashare/btv/bencode.py View File

@@ -57,7 +57,7 @@ def decode_string(x, f):
colon += 1
return (x[colon:colon+n], colon+n)

def decode_unicode(x, f):
def decode_unicode(x, f): # pragma: no cover
s, f = decode_string(x, f+1)
return (s.decode('UTF-8'),f)

@@ -332,6 +332,14 @@ def test_bencode():
except (ValueError, AssertionError):
pass

import unittest

class _TestCases(unittest.TestCase):
def test_bencode(self):
test_bencode()

def test_bdecode(self):
test_bdecode()

try:
import psyco


+ 2
- 0
ui/medashare/tests.py View File

@@ -1,3 +1,5 @@
from .btv import _TestCases as btv_test_cases
from .btv.bencode import _TestCases as bencode_test_cases
from .cli import _TestCononicalCoder, _TestCases as cli_test_cases
from .cli import _TestJSONEncoder
from .mtree import Test


Loading…
Cancel
Save