diff --git a/tests/examples.py b/tests/examples.py index 23e61ab..e34a8fb 100644 --- a/tests/examples.py +++ b/tests/examples.py @@ -1,121 +1,60 @@ from __future__ import absolute_import, division, print_function +import os + import tldp.doctypes +datadir = os.path.join(os.path.dirname(__file__), 'testdata') + ex_linuxdoc = { 'ext': '.sgml', 'type': tldp.doctypes.linuxdoc.Linuxdoc, - 'content': ''' -
-B -<author>A -<date>2016-02-11 -<abstract> abstract </abstract> -<toc> -<sect>Introduction -<p> -<sect>Stuff. -<p> -<sect>More-stuff. -<p> -</article>''', + 'filename': os.path.join(datadir, 'linuxdoc-simple.sgml'), } ex_docbooksgml = { 'ext': '.sgml', 'type': tldp.doctypes.docbooksgml.DocbookSGML, - 'content': '''<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN"> -<article> - <articleinfo> - <title>T - - A B - -
devnull@example.org
-
-
- 2016-02-11 - abstract - - - 1.0 - 2016-02-11 - AB - Initial release. - - - - - - Introduction - Text - More stuff - Text - - -
''' + 'filename': os.path.join(datadir, 'docbooksgml-simple.sgml'), } ex_docbook4xml = { 'ext': '.xml', 'type': tldp.doctypes.docbook4xml.Docbook4XML, - 'content': ''' - -
- - T - AB - AB - - v0.0 - 2016-02-11 - AB - Initial release. - - abstract - - - - Intro - Text - - Intro - Text - - - -
''' + 'filename': os.path.join(datadir, 'docbook4xml-simple.xml'), } ex_docbook5xml = { 'ext': '.xml', 'type': tldp.doctypes.docbook5xml.Docbook5XML, - 'content': ''' -
- Sample article - This is a ridiculously terse article. -
''' + 'filename': os.path.join(datadir, 'docbook5xml-simple.xml'), } ex_rst = { 'ext': '.rst', 'type': tldp.doctypes.rst.RestructuredText, - 'content': '''Empty.''', + 'filename': os.path.join(datadir, 'restructuredtext-simple.rst'), } ex_text = { 'ext': '.txt', 'type': tldp.doctypes.text.Text, - 'content': '''Empty.''', + 'filename': os.path.join(datadir, 'text-simple.txt'), } ex_markdown = { 'ext': '.md', 'type': tldp.doctypes.markdown.Markdown, - 'content': '''Empty.''', + 'filename': os.path.join(datadir, 'markdown-simple.md'), } +# -- a bit ugly, but grab each dict +examples = [y for x, y in locals().items() if x.startswith('ex_')] + +for ex in examples: + ex['content'] = open(ex['filename']).read() + + # -- end of file