#! /usr/bin/env python # $Id: test_date.py 4667 2006-07-12 21:40:56Z wiemann $ # Author: David Goodger # Copyright: This module has been placed in the public domain. """ Tests for the misc.py "date" directive. """ from .__init__ import DocutilsTestSupport import time def suite(): s = DocutilsTestSupport.ParserTestSuite() s.generateTests(totest) return s totest = {} totest['date'] = [ ["""\ .. |date| date:: Today's date is |date|. """, """\ %s Today's date is \n\ date . """ % time.strftime('%Y-%m-%d')], ["""\ .. |date| date:: %a, %d %b %Y """, """\ %s """ % time.strftime('%a, %d %b %Y')], ["""\ .. date:: """, """\ Invalid context: the "date" directive can only be used within a substitution definition. .. date:: """], ] if __name__ == '__main__': import unittest unittest.main(defaultTest='suite')