summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2018-02-18 20:18:52 +0000
committerrsiddharth <s@ricketyspace.net>2018-02-18 20:18:52 +0000
commit6d34500e55eb225a89d26ed7606a772c638b6984 (patch)
tree5b957d733109806b89882aeb6d34ea52b43e4a35 /tests
parentb6a4d7a645c784b7bd3f6d64298d7b9047cf22c3 (diff)
md_tw.py: Add TWBlockLexer.parse_block_html.
* md_tw.py (TWBlockLexer)[parse_block_html]: New method. * tests/test_md_tw.py (TestTWBlockLexer) [test_parse_block_html]: Update test method.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_md_tw.py31
1 files changed, 8 insertions, 23 deletions
diff --git a/tests/test_md_tw.py b/tests/test_md_tw.py
index 47f354c..7d42e14 100644
--- a/tests/test_md_tw.py
+++ b/tests/test_md_tw.py
@@ -594,7 +594,7 @@ class TestTWBlockLexer(object):
validate(token, expected_token)
- if type_ in ['open_html', 'close_html']:
+ if type_ == 'block_html':
break
else:
token = tokens.pop(0)
@@ -604,51 +604,36 @@ class TestTWBlockLexer(object):
def validate(token, expected_token=None):
type_ = token['type']
- if type_ == 'open_html':
- assert 'tag' in token
- assert 'extra' in token
- assert 'text' in token
- elif type_ == 'close_html':
- assert 'text' in token
-
if not expected_token:
return
if 'text' in token:
nose_tools.assert_equal(token['text'], expected_token['text'])
- if 'extra' in token:
- nose_tools.assert_equal(token['extra'], expected_token['extra'])
- if 'tag' in token:
- nose_tools.assert_equal(token['tag'], expected_token['tag'])
return
expected = {
- 'open_html': [
+ 'block_html': [
{
- 'tag': 'table',
- 'extra': '',
- 'text': '\n <tr>\n <td>Monte Carlo</td>'
- '\n </tr>\n'
+ 'text': '<table>\n <tr>\n <td>Monte Carlo</td>'
+ '\n </tr>\n</table>\n\n'
},
],
}
tokens = process(tokens)
expected = {
- 'open_html': [
+ 'block_html': [
{
- 'tag': 'div',
- 'extra': ' class="parley"',
- 'text': '\n <article>\n '
+ 'text': '<div class="parley">\n <article>\n '
'<p>A dispute conference; human snafu.</p>\n '
- '</article>\n'
+ '</article>\n</div>\n\n'
}
],
}
tokens = process(tokens)
expected = {
- 'close_html': [
+ 'block_html': [
{'text': '<hr />\n\n'}
]
}