#! /usr/bin/env python # $Id: test_replace.py 7021 2011-04-29 23:20:54Z grubert $ # Author: David Goodger # Copyright: This module has been placed in the public domain. """ Tests for misc.py "replace" directive. """ from .__init__ import DocutilsTestSupport def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['replace'] = [ ["""\ Test the |name| directive. .. |name| replace:: "**replace**" """, """\ Test the \n\ name directive. " replace " """], ["""\ .. |name| replace:: paragraph 1 paragraph 2 """, """\ Error in "replace" directive: may contain a single paragraph only. Substitution definition "name" empty or invalid. .. |name| replace:: paragraph 1 paragraph 2 """], ["""\ .. |name| replace:: """, """\ Content block expected for the "replace" directive; none found. replace:: Substitution definition "name" empty or invalid. .. |name| replace:: """], ["""\ .. |Python| replace:: Python, *the* best language around .. _Python: http://www.python.org/ I recommend you try |Python|_. """, """\ Python, the best language around I recommend you try Python . """], ["""\ .. |name| replace:: *error in **inline ``markup """, """\ Inline emphasis start-string without end-string. Inline strong start-string without end-string. Inline literal start-string without end-string. Substitution definition contains illegal element: * .. |name| replace:: *error in **inline ``markup """], ["""\ .. replace:: not valid outside of a substitution definition """, """\ Invalid context: the "replace" directive can only be used within a substitution definition. .. replace:: not valid outside of a substitution definition """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite')