comparison sat/test/test_plugin_misc_text_syntaxes.py @ 2624:56f94936df1e

code style reformatting using black
author Goffi <goffi@goffi.org>
date Wed, 27 Jun 2018 20:14:46 +0200
parents 26edcf3a30eb
children 003b8b4b56a7
comparison
equal deleted inserted replaced
2623:49533de4540b 2624:56f94936df1e
89 return d 89 return d
90 90
91 def test_html2text(self): 91 def test_html2text(self):
92 """Check that html2text is not inserting \n in the middle of that link. 92 """Check that html2text is not inserting \n in the middle of that link.
93 By default lines are truncated after the 79th characters.""" 93 By default lines are truncated after the 79th characters."""
94 source = "<img src=\"http://sat.goffi.org/static/images/screenshots/libervia/libervia_discussions.png\" alt=\"sat\"/>" 94 source = '<img src="http://sat.goffi.org/static/images/screenshots/libervia/libervia_discussions.png" alt="sat"/>'
95 expected = "![sat](http://sat.goffi.org/static/images/screenshots/libervia/libervia_discussions.png)" 95 expected = "![sat](http://sat.goffi.org/static/images/screenshots/libervia/libervia_discussions.png)"
96 try: 96 try:
97 d = self.text_syntaxes.convert(source, self.text_syntaxes.SYNTAX_XHTML, self.text_syntaxes.SYNTAX_MARKDOWN) 97 d = self.text_syntaxes.convert(
98 source,
99 self.text_syntaxes.SYNTAX_XHTML,
100 self.text_syntaxes.SYNTAX_MARKDOWN,
101 )
98 except plugin_misc_text_syntaxes.UnknownSyntax: 102 except plugin_misc_text_syntaxes.UnknownSyntax:
99 raise SkipTest("Markdown syntax is not available.") 103 raise SkipTest("Markdown syntax is not available.")
100 d.addCallback(self.assertEqual, expected) 104 d.addCallback(self.assertEqual, expected)
101 return d 105 return d
102 106
106 self.assertEqual(re.sub(r"\s+", " ", result).rstrip(), expected.rstrip()) 110 self.assertEqual(re.sub(r"\s+", " ", result).rstrip(), expected.rstrip())
107 111
108 expected = u"""test retest toto""" 112 expected = u"""test retest toto"""
109 result = self.text_syntaxes._removeMarkups(self.EVIL_HTML2) 113 result = self.text_syntaxes._removeMarkups(self.EVIL_HTML2)
110 self.assertEqual(re.sub(r"\s+", " ", result).rstrip(), expected.rstrip()) 114 self.assertEqual(re.sub(r"\s+", " ", result).rstrip(), expected.rstrip())
111