update tests
This commit is contained in:
parent
e3feffa989
commit
23938cb8ed
1 changed files with 5 additions and 23 deletions
|
|
@ -120,13 +120,6 @@ class TestText2Html(TestCase):
|
||||||
)
|
)
|
||||||
# TODO: doesn't URL encode correctly
|
# TODO: doesn't URL encode correctly
|
||||||
|
|
||||||
def test_re_double_space(self):
|
|
||||||
parser = text2html.HTML_PARSER
|
|
||||||
self.assertEqual("foo", parser.re_double_space("foo"))
|
|
||||||
self.assertEqual(
|
|
||||||
"a red foo", parser.re_double_space("a red foo")
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_sub_mxp_links(self):
|
def test_sub_mxp_links(self):
|
||||||
parser = text2html.HTML_PARSER
|
parser = text2html.HTML_PARSER
|
||||||
mocked_match = mock.Mock()
|
mocked_match = mock.Mock()
|
||||||
|
|
@ -156,7 +149,7 @@ class TestText2Html(TestCase):
|
||||||
"tab": "\t",
|
"tab": "\t",
|
||||||
"space": "",
|
"space": "",
|
||||||
}
|
}
|
||||||
self.assertEqual(" ", parser.sub_text(mocked_match))
|
self.assertEqual(" ", parser.sub_text(mocked_match))
|
||||||
|
|
||||||
mocked_match.groupdict.return_value = {
|
mocked_match.groupdict.return_value = {
|
||||||
"htmlchars": "",
|
"htmlchars": "",
|
||||||
|
|
@ -165,7 +158,7 @@ class TestText2Html(TestCase):
|
||||||
"space": " ",
|
"space": " ",
|
||||||
"spacestart": " ",
|
"spacestart": " ",
|
||||||
}
|
}
|
||||||
self.assertEqual(" ", parser.sub_text(mocked_match))
|
self.assertEqual(" ", parser.sub_text(mocked_match))
|
||||||
|
|
||||||
mocked_match.groupdict.return_value = {
|
mocked_match.groupdict.return_value = {
|
||||||
"htmlchars": "",
|
"htmlchars": "",
|
||||||
|
|
@ -181,24 +174,13 @@ class TestText2Html(TestCase):
|
||||||
parser = text2html.HTML_PARSER
|
parser = text2html.HTML_PARSER
|
||||||
parser.tabstop = 4
|
parser.tabstop = 4
|
||||||
# single tab
|
# single tab
|
||||||
self.assertEqual(parser.parse("foo|>foo"), "foo foo")
|
self.assertEqual(parser.parse("foo|>foo"), "foo foo")
|
||||||
|
|
||||||
# space and tab
|
# space and tab
|
||||||
self.assertEqual(parser.parse("foo |>foo"), "foo foo")
|
self.assertEqual(parser.parse("foo |>foo"), "foo foo")
|
||||||
|
|
||||||
# space, tab, space
|
# space, tab, space
|
||||||
self.assertEqual(parser.parse("foo |> foo"), "foo foo")
|
self.assertEqual(parser.parse("foo |> foo"), "foo foo")
|
||||||
|
|
||||||
def test_parse_space_to_html(self):
|
|
||||||
"""test space parsing - a single space should be kept, two or more
|
|
||||||
should get """
|
|
||||||
parser = text2html.HTML_PARSER
|
|
||||||
# single space
|
|
||||||
self.assertEqual(parser.parse("foo foo"), "foo foo")
|
|
||||||
# double space
|
|
||||||
self.assertEqual(parser.parse("foo foo"), "foo foo")
|
|
||||||
# triple space
|
|
||||||
self.assertEqual(parser.parse("foo foo"), "foo foo")
|
|
||||||
|
|
||||||
def test_parse_html(self):
|
def test_parse_html(self):
|
||||||
self.assertEqual("foo", text2html.parse_html("foo"))
|
self.assertEqual("foo", text2html.parse_html("foo"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue