summaryrefslogtreecommitdiff
path: root/tests/test_apis.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_apis.py')
-rw-r--r--tests/test_apis.py72
1 files changed, 36 insertions, 36 deletions
diff --git a/tests/test_apis.py b/tests/test_apis.py
index 1a38be6..82bc3b8 100644
--- a/tests/test_apis.py
+++ b/tests/test_apis.py
@@ -21,7 +21,7 @@ License: BSD (see LICENSE.md for details).
Python-Markdown Regression Tests
================================
-Tests of the various APIs with the python markdown lib.
+Tests of the various APIs with the Python Markdown library.
"""
import unittest
@@ -122,7 +122,7 @@ class TestBlockParser(unittest.TestCase):
self.parser = markdown.Markdown().parser
def testParseChunk(self):
- """ Test BlockParser.parseChunk. """
+ """ Test `BlockParser.parseChunk`. """
root = etree.Element("div")
text = 'foo'
self.parser.parseChunk(root, text)
@@ -132,7 +132,7 @@ class TestBlockParser(unittest.TestCase):
)
def testParseDocument(self):
- """ Test BlockParser.parseDocument. """
+ """ Test `BlockParser.parseDocument`. """
lines = ['#foo', '', 'bar', '', ' baz']
tree = self.parser.parseDocument(lines)
self.assertIsInstance(tree, etree.ElementTree)
@@ -144,7 +144,7 @@ class TestBlockParser(unittest.TestCase):
class TestBlockParserState(unittest.TestCase):
- """ Tests of the State class for BlockParser. """
+ """ Tests of the State class for `BlockParser`. """
def setUp(self):
self.state = markdown.blockparser.State()
@@ -161,7 +161,7 @@ class TestBlockParserState(unittest.TestCase):
self.assertEqual(self.state, ['a_state', 'state2'])
def testIsSate(self):
- """ Test State.isstate(). """
+ """ Test `State.isstate()`. """
self.assertEqual(self.state.isstate('anything'), False)
self.state.set('a_state')
self.assertEqual(self.state.isstate('a_state'), True)
@@ -171,7 +171,7 @@ class TestBlockParserState(unittest.TestCase):
self.assertEqual(self.state.isstate('missing'), False)
def testReset(self):
- """ Test State.reset(). """
+ """ Test `State.reset()`. """
self.state.set('a_state')
self.state.reset()
self.assertEqual(self.state, [])
@@ -182,20 +182,20 @@ class TestBlockParserState(unittest.TestCase):
class TestHtmlStash(unittest.TestCase):
- """ Test Markdown's HtmlStash. """
+ """ Test Markdown's `HtmlStash`. """
def setUp(self):
self.stash = markdown.util.HtmlStash()
self.placeholder = self.stash.store('foo')
def testSimpleStore(self):
- """ Test HtmlStash.store. """
+ """ Test `HtmlStash.store`. """
self.assertEqual(self.placeholder, self.stash.get_placeholder(0))
self.assertEqual(self.stash.html_counter, 1)
self.assertEqual(self.stash.rawHtmlBlocks, ['foo'])
def testStoreMore(self):
- """ Test HtmlStash.store with additional blocks. """
+ """ Test `HtmlStash.store` with additional blocks. """
placeholder = self.stash.store('bar')
self.assertEqual(placeholder, self.stash.get_placeholder(1))
self.assertEqual(self.stash.html_counter, 2)
@@ -205,14 +205,14 @@ class TestHtmlStash(unittest.TestCase):
)
def testReset(self):
- """ Test HtmlStash.reset. """
+ """ Test `HtmlStash.reset`. """
self.stash.reset()
self.assertEqual(self.stash.html_counter, 0)
self.assertEqual(self.stash.rawHtmlBlocks, [])
class Item:
- """ A dummy Registry item object for testing. """
+ """ A dummy `Registry` item object for testing. """
def __init__(self, data):
self.data = data
@@ -272,11 +272,11 @@ class RegistryTests(unittest.TestCase):
self.assertEqual(len(r), 2)
r.deregister('c', strict=False)
self.assertEqual(len(r), 1)
- # deregister non-existent item with strict=False
+ # deregister non-existent item with `strict=False`
r.deregister('d', strict=False)
self.assertEqual(len(r), 1)
with self.assertRaises(ValueError):
- # deregister non-existent item with strict=True
+ # deregister non-existent item with `strict=True`
r.deregister('e')
self.assertEqual(list(r), ['a'])
@@ -396,7 +396,7 @@ class TestErrors(unittest.TestCase):
)
def testBaseExtention(self):
- """ Test that the base Extension class will raise NotImplemented. """
+ """ Test that the base Extension class will raise `NotImplemented`. """
self.assertRaises(
NotImplementedError,
markdown.Markdown, extensions=[markdown.extensions.Extension()]
@@ -405,11 +405,11 @@ class TestErrors(unittest.TestCase):
class testETreeComments(unittest.TestCase):
"""
- Test that ElementTree Comments work.
+ Test that `ElementTree` Comments work.
- These tests should only be a concern when using cElementTree with third
+ These tests should only be a concern when using `cElementTree` with third
party serializers (including markdown's (x)html serializer). While markdown
- doesn't use ElementTree.Comment itself, we should certainly support any
+ doesn't use `ElementTree.Comment` itself, we should certainly support any
third party extensions which may. Therefore, these tests are included to
ensure such support is maintained.
"""
@@ -419,23 +419,23 @@ class testETreeComments(unittest.TestCase):
self.comment = etree.Comment('foo')
def testCommentIsComment(self):
- """ Test that an ElementTree Comment passes the `is Comment` test. """
+ """ Test that an `ElementTree` `Comment` passes the `is Comment` test. """
self.assertIs(self.comment.tag, etree.Comment)
def testCommentIsBlockLevel(self):
- """ Test that an ElementTree Comment is recognized as BlockLevel. """
+ """ Test that an `ElementTree` `Comment` is recognized as `BlockLevel`. """
md = markdown.Markdown()
self.assertIs(md.is_block_level(self.comment.tag), False)
def testCommentSerialization(self):
- """ Test that an ElementTree Comment serializes properly. """
+ """ Test that an `ElementTree` `Comment` serializes properly. """
self.assertEqual(
markdown.serializers.to_html_string(self.comment),
'<!--foo-->'
)
def testCommentPrettify(self):
- """ Test that an ElementTree Comment is prettified properly. """
+ """ Test that an `ElementTree` `Comment` is prettified properly. """
pretty = markdown.treeprocessors.PrettifyTreeprocessor(markdown.Markdown())
pretty.run(self.comment)
self.assertEqual(
@@ -450,7 +450,7 @@ class testElementTailTests(unittest.TestCase):
self.pretty = markdown.treeprocessors.PrettifyTreeprocessor(markdown.Markdown())
def testBrTailNoNewline(self):
- """ Test that last <br> in tree has a new line tail """
+ """ Test that last `<br>` in tree has a new line tail """
root = etree.Element('root')
br = etree.SubElement(root, 'br')
self.assertEqual(br.tail, None)
@@ -459,7 +459,7 @@ class testElementTailTests(unittest.TestCase):
class testElementPreCodeTests(unittest.TestCase):
- """ Element PreCode Tests """
+ """ Element `PreCode` Tests """
def setUp(self):
md = markdown.Markdown()
self.pretty = markdown.treeprocessors.PrettifyTreeprocessor(md)
@@ -557,7 +557,7 @@ class testSerializers(unittest.TestCase):
)
def testProsessingInstruction(self):
- """ Test serialization of ProcessignInstruction. """
+ """ Test serialization of `ProcessignInstruction`. """
pi = ProcessingInstruction('foo', text='<&"test\nescaping">')
self.assertIs(pi.tag, ProcessingInstruction)
self.assertEqual(
@@ -566,7 +566,7 @@ class testSerializers(unittest.TestCase):
)
def testQNameTag(self):
- """ Test serialization of QName tag. """
+ """ Test serialization of `QName` tag. """
div = etree.Element('div')
qname = etree.QName('http://www.w3.org/1998/Math/MathML', 'math')
math = etree.SubElement(div, qname)
@@ -595,7 +595,7 @@ class testSerializers(unittest.TestCase):
)
def testQNameAttribute(self):
- """ Test serialization of QName attribute. """
+ """ Test serialization of `QName` attribute. """
div = etree.Element('div')
div.set(etree.QName('foo'), etree.QName('bar'))
self.assertEqual(
@@ -604,13 +604,13 @@ class testSerializers(unittest.TestCase):
)
def testBadQNameTag(self):
- """ Test serialization of QName with no tag. """
+ """ Test serialization of `QName` with no tag. """
qname = etree.QName('http://www.w3.org/1998/Math/MathML')
el = etree.Element(qname)
self.assertRaises(ValueError, markdown.serializers.to_xhtml_string, el)
def testQNameEscaping(self):
- """ Test QName escaping. """
+ """ Test `QName` escaping. """
qname = etree.QName('<&"test\nescaping">', 'div')
el = etree.Element(qname)
self.assertEqual(
@@ -619,7 +619,7 @@ class testSerializers(unittest.TestCase):
)
def testQNamePreEscaping(self):
- """ Test QName that is already partially escaped. """
+ """ Test `QName` that is already partially escaped. """
qname = etree.QName('&lt;&amp;"test&#10;escaping"&gt;', 'div')
el = etree.Element(qname)
self.assertEqual(
@@ -628,9 +628,9 @@ class testSerializers(unittest.TestCase):
)
def buildExtension(self):
- """ Build an extension which registers fakeSerializer. """
+ """ Build an extension which registers `fakeSerializer`. """
def fakeSerializer(elem):
- # Ignore input and return hardcoded output
+ # Ignore input and return hard-coded output
return '<div><p>foo</p></div>'
class registerFakeSerializer(markdown.extensions.Extension):
@@ -661,7 +661,7 @@ class testSerializers(unittest.TestCase):
class testAtomicString(unittest.TestCase):
- """ Test that AtomicStrings are honored (not parsed). """
+ """ Test that `AtomicStrings` are honored (not parsed). """
def setUp(self):
md = markdown.Markdown()
@@ -679,7 +679,7 @@ class testAtomicString(unittest.TestCase):
)
def testSimpleAtomicString(self):
- """ Test that a simple AtomicString is not parsed. """
+ """ Test that a simple `AtomicString` is not parsed. """
tree = etree.Element('div')
p = etree.SubElement(tree, 'p')
p.text = markdown.util.AtomicString('some *text*')
@@ -690,7 +690,7 @@ class testAtomicString(unittest.TestCase):
)
def testNestedAtomicString(self):
- """ Test that a nested AtomicString is not parsed. """
+ """ Test that a nested `AtomicString` is not parsed. """
tree = etree.Element('div')
p = etree.SubElement(tree, 'p')
p.text = markdown.util.AtomicString('*some* ')
@@ -815,7 +815,7 @@ class TestCliOptionParsing(unittest.TestCase):
self.assertEqual(options, self.default_options)
def create_config_file(self, config):
- """ Helper to create temp config files. """
+ """ Helper to create temporary configuration files. """
if not isinstance(config, str):
# convert to string
config = yaml.dump(config)
@@ -894,7 +894,7 @@ class TestEscapeAppend(unittest.TestCase):
class TestBlockAppend(unittest.TestCase):
- """ Tests block kHTML append. """
+ """ Tests block `kHTML` append. """
def testBlockAppend(self):
""" Test that appended escapes are only in the current instance. """