move docs tests to own file

This commit is contained in:
Jack Robison 2018-04-12 14:04:22 -04:00
parent c089f1954a
commit 2655797692
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 17 additions and 16 deletions

View file

@ -1,7 +1,5 @@
import docopt
from twisted.trial import unittest
from lbrynet.daemon import DaemonCLI
from lbrynet.daemon.Daemon import Daemon
class DaemonCLITests(unittest.TestCase):
@ -31,17 +29,3 @@ class DaemonCLITests(unittest.TestCase):
self.assertEqual('3', DaemonCLI.guess_type('3', key="channel_name"))
self.assertEqual(3, DaemonCLI.guess_type('3', key="some_other_thing"))
class DaemonDocsTests(unittest.TestCase):
def test_can_parse_api_method_docs(self):
failures = []
for name, fn in Daemon.callable_methods.iteritems():
try:
docopt.docopt(fn.__doc__, ())
except docopt.DocoptLanguageError as err:
failures.append("invalid docstring for %s, %s" % (name, err.message))
except docopt.DocoptExit:
pass
if failures:
self.fail("\n" + "\n".join(failures))

View file

@ -0,0 +1,17 @@
import docopt
from twisted.trial import unittest
from lbrynet.daemon.Daemon import Daemon
class DaemonDocsTests(unittest.TestCase):
def test_can_parse_api_method_docs(self):
failures = []
for name, fn in Daemon.callable_methods.iteritems():
try:
docopt.docopt(fn.__doc__, ())
except docopt.DocoptLanguageError as err:
failures.append("invalid docstring for %s, %s" % (name, err.message))
except docopt.DocoptExit:
pass
if failures:
self.fail("\n" + "\n".join(failures))