From 3d648c2d290941f75ab730ab1990e9df311889b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Latinier?= Date: Wed, 25 Apr 2018 21:20:42 +0200 Subject: [PATCH] fix tests due to non predictive html rendering --- isso/tests/test_html.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/isso/tests/test_html.py b/isso/tests/test_html.py index 327357c..42baa82 100644 --- a/isso/tests/test_html.py +++ b/isso/tests/test_html.py @@ -65,13 +65,17 @@ class TestHTML(unittest.TestCase): examples = [ ('Look: ', 'Look: '), ('Ha', - 'Ha'), + ['Ha', + 'Ha']), ('Ha', 'Ha'), ('

Test

', '

Test

'), ('', 'alert("Onoe")')] for (input, expected) in examples: - self.assertEqual(html.sanitize(sanitizer, input), expected) + if isinstance(expected, list): + self.assertIn(html.sanitize(sanitizer, input), expected) + else: + self.assertEqual(html.sanitize(sanitizer, input), expected) @unittest.skipIf(html.HTML5LIB_VERSION <= html.HTML5LIB_SIMPLETREE, "backport") def test_sanitizer_extensions(self): @@ -92,5 +96,6 @@ class TestHTML(unittest.TestCase): } }) renderer = html.Markup(conf.section("markup")).render - self.assertEqual(renderer("http://example.org/ and sms:+1234567890"), - '

http://example.org/ and sms:+1234567890

') + self.assertIn(renderer("http://example.org/ and sms:+1234567890"), + ['

http://example.org/ and sms:+1234567890

', + '

http://example.org/ and sms:+1234567890

'])