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

18 lines
574 B
Python
Raw Normal View History

2018-04-12 20:04:22 +02:00
import docopt
2019-01-22 23:54:25 +01:00
import unittest
from lbrynet.extras.daemon.Daemon import Daemon
2018-04-12 20:04:22 +02:00
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))