mirror of https://github.com/tLDP/python-tldp
move testdata to sample directory
This commit is contained in:
parent
336faa4df5
commit
d9c7ac1944
|
@ -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': '''<!doctype linuxdoc system>
|
||||
<article>
|
||||
<title>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</title>
|
||||
<author>
|
||||
<firstname>A</firstname> <surname>B</surname>
|
||||
<affiliation>
|
||||
<address><email>devnull@example.org</email></address>
|
||||
</affiliation>
|
||||
</author>
|
||||
<pubdate>2016-02-11</pubdate>
|
||||
<abstract><para>abstract</para> </abstract>
|
||||
<revhistory>
|
||||
<revision>
|
||||
<revnumber>1.0</revnumber>
|
||||
<date>2016-02-11</date>
|
||||
<authorinitials>AB</authorinitials>
|
||||
<revremark>Initial release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
</articleinfo>
|
||||
|
||||
<sect1 id="intro"><title>Introduction</title>
|
||||
<para>Text</para>
|
||||
<sect2 id="copyright"><title>More stuff</title>
|
||||
<para>Text</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
</article>'''
|
||||
'filename': os.path.join(datadir, 'docbooksgml-simple.sgml'),
|
||||
}
|
||||
|
||||
ex_docbook4xml = {
|
||||
'ext': '.xml',
|
||||
'type': tldp.doctypes.docbook4xml.Docbook4XML,
|
||||
'content': '''<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
|
||||
<article>
|
||||
<articleinfo>
|
||||
<title>T</title>
|
||||
<author><firstname>A</firstname><surname>B</surname></author>
|
||||
<authorinitials>AB</authorinitials>
|
||||
<revhistory> <revision>
|
||||
<revnumber>v0.0</revnumber>
|
||||
<date>2016-02-11</date>
|
||||
<authorinitials>AB</authorinitials>
|
||||
<revremark> Initial release. </revremark>
|
||||
</revision> </revhistory>
|
||||
<abstract> <para> abstract </para> </abstract>
|
||||
</articleinfo>
|
||||
|
||||
<sect1 id="intro">
|
||||
<title>Intro</title>
|
||||
<para>Text</para>
|
||||
<sect2>
|
||||
<title>Intro</title>
|
||||
<para>Text</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
</article>'''
|
||||
'filename': os.path.join(datadir, 'docbook4xml-simple.xml'),
|
||||
}
|
||||
|
||||
ex_docbook5xml = {
|
||||
'ext': '.xml',
|
||||
'type': tldp.doctypes.docbook5xml.Docbook5XML,
|
||||
'content': '''<?xml version="1.0" encoding="utf-8"?>
|
||||
<article xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="en">
|
||||
<title>Sample article</title>
|
||||
<para>This is a ridiculously terse article.</para>
|
||||
</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
|
||||
|
|
Loading…
Reference in New Issue