From 729f22e4314dbe98547e6f4f0f8e82883576dfb8 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Fri, 26 Aug 2022 15:07:27 -0700 Subject: [PATCH] add bencode tests to run automaticaly, no cover unused func --- ui/medashare/btv/bencode.py | 10 +++++++++- ui/medashare/tests.py | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/medashare/btv/bencode.py b/ui/medashare/btv/bencode.py index 8e05613..1ba522f 100644 --- a/ui/medashare/btv/bencode.py +++ b/ui/medashare/btv/bencode.py @@ -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 diff --git a/ui/medashare/tests.py b/ui/medashare/tests.py index db68722..ebadd83 100644 --- a/ui/medashare/tests.py +++ b/ui/medashare/tests.py @@ -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