Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_html_to_nodes_multi_line(self):
self.assertEqual(
html_to_nodes(HTML_MULTI_LINES),
HTML_MULTI_LINES_NODES_LIST
)
self.assertEqual(
html_to_nodes(HTML_MULTI_LINES1),
HTML_MULTI_LINES_NODES_LIST
)
def test_html_to_nodes_invalid_html(self):
with self.assertRaises(InvalidHTML):
html_to_nodes('<p><b></b></p>')
def test_html_to_nodes_not_allowed_tag(self):
with self.assertRaises(NotAllowedTag):
html_to_nodes('')
def test_html_to_nodes(self):
self.assertEqual(
html_to_nodes(HTML_TEST_STR),
NODES_TEST_LIST
)
def test_html_to_nodes_multi_line(self):
self.assertEqual(
html_to_nodes(HTML_MULTI_LINES),
HTML_MULTI_LINES_NODES_LIST
)
self.assertEqual(
html_to_nodes(HTML_MULTI_LINES1),
HTML_MULTI_LINES_NODES_LIST
)
def test_no_starttag_node(self):
with self.assertRaises(InvalidHTML):
html_to_nodes(HTML_NO_STARTTAG)
:param title: Page title
:param content: Content in nodes list format (see doc)
:param html_content: Content in HTML format
:param author_name: Author name, displayed below the article's title
:param author_url: Profile link, opened when users click on
the author's name below the title
:param return_content: If true, a content field will be returned
"""
if content is None:
content = html_to_nodes(html_content)
content_json = json.dumps(content, ensure_ascii=False)
return self._telegraph.method('createPage', values={
'title': title,
'author_name': author_name,
'author_url': author_url,
'content': content_json,
'return_content': return_content
})
:param title: Page title
:param content: Content in nodes list format (see doc)
:param html_content: Content in HTML format
:param author_name: Author name, displayed below the article's title
:param author_url: Profile link, opened when users click on
the author's name below the title
:param return_content: If true, a content field will be returned
"""
if content is None:
content = html_to_nodes(html_content)
content_json = json.dumps(content, ensure_ascii=False)
return self._telegraph.method('editPage', path=path, values={
'title': title,
'author_name': author_name,
'author_url': author_url,
'content': content_json,
'return_content': return_content
})