test_docutils.py 673 B

123456789101112131415161718192021222324252627
  1. # Copyright (c) Jupyter Development Team.
  2. # Distributed under the terms of the Modified BSD License.
  3. from unittest import TestCase
  4. from ipywidgets.widgets.docutils import doc_subst
  5. class TestDocSubst(TestCase):
  6. def test_substitution(self):
  7. snippets = {'key': '62'}
  8. @doc_subst(snippets)
  9. def f():
  10. """ Docstring with value {key} """
  11. assert f.__doc__ == " Docstring with value 62 "
  12. def test_unused_keys(self):
  13. snippets = {'key': '62', 'other-key': 'unused'}
  14. @doc_subst(snippets)
  15. def f():
  16. """ Docstring with value {key} """
  17. assert f.__doc__ == " Docstring with value 62 "