Skip to content

Commit

Permalink
Fix python3 html encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
python273 committed Dec 20, 2016
1 parent 3ec7a2c commit e6236a8
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions tests/test_html_converter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from unittest import TestCase

import sys
from telegraph.utils import html_to_nodes, nodes_to_html


Expand All @@ -18,14 +18,30 @@
}
]

NODES_TEST_LIST_PY35 = [
{'tag': 'p', 'children': ['Hello, world!']},
{'tag': 'p', 'children': [{
'tag': 'a',
'attrs': {'href': 'https://telegra.ph/'},
'children': ['Test link</a>']
}]
}
]


class TestHTMLConverter(TestCase):
def test_html_to_nodes(self):

self.assertEqual(
html_to_nodes(HTML_TEST_STR),
NODES_TEST_LIST
)
if sys.version_info.major == 3 and sys.version_info.minor == 5:
self.assertEqual(
html_to_nodes(HTML_TEST_STR),
NODES_TEST_LIST_PY35
)
else:
self.assertEqual(
html_to_nodes(HTML_TEST_STR),
NODES_TEST_LIST
)

def test_nodes_to_html(self):
self.assertEqual(
Expand Down

0 comments on commit e6236a8

Please sign in to comment.