lbry-sdk/tests/unit/lbrynet_daemon/test_docs.py

18 lines
586 B
Python
Raw Normal View History

2018-04-12 20:04:22 +02:00
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.items():
2018-04-12 20:04:22 +02:00
try:
docopt.docopt(fn.__doc__, ())
except docopt.DocoptLanguageError as err:
failures.append(f"invalid docstring for {name}, {err.message}")
2018-04-12 20:04:22 +02:00
except docopt.DocoptExit:
pass
if failures:
self.fail("\n" + "\n".join(failures))