From aec230435181664950b9281bf36810fe5484251c Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Wed, 3 Jan 2024 20:54:49 +0100 Subject: [PATCH] Add another whitespace preservation test Refs #28. --- html_sanitizer/tests.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/html_sanitizer/tests.py b/html_sanitizer/tests.py index fc2c27b..9f15118 100644 --- a/html_sanitizer/tests.py +++ b/html_sanitizer/tests.py @@ -617,3 +617,24 @@ def test_img_tag(self): ) self.run_tests(entries, sanitizer=sanitizer) + + def test_code_whitespace(self): + sanitizer = Sanitizer( + { + "tags": {"code"}, + "empty": set(), + "separate": set(), + "attributes": {}, + "keep_typographic_whitespace": True, + } + ) + + html = """\ + +git status +git add +git commit + +""" + + self.run_tests([(html, html)], sanitizer=sanitizer)