From 6d34500e55eb225a89d26ed7606a772c638b6984 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 18 Feb 2018 20:18:52 +0000 Subject: 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. --- tests/test_md_tw.py | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'tests') 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 \n Monte Carlo' - '\n \n' + 'text': '\n \n ' + '\n \n
Monte Carlo
\n\n' }, ], } tokens = process(tokens) expected = { - 'open_html': [ + 'block_html': [ { - 'tag': 'div', - 'extra': ' class="parley"', - 'text': '\n
\n ' + 'text': '
\n
\n ' '

A dispute conference; human snafu.

\n ' - '
\n' + '
\n\n\n' } ], } tokens = process(tokens) expected = { - 'close_html': [ + 'block_html': [ {'text': '
\n\n'} ] } -- cgit v1.2.3