From 908fe9df349231849fd517a367a1b908820dc082 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Sun, 27 Aug 2017 02:16:31 +0000 Subject: [PATCH] tests: Add unit tests for preservation of quotes in CSS styles These tests will ensure that issues #21 and #56 do not return. --- testscour.py | 11 +++++++++++ unittests/quotes-in-styles.svg | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 unittests/quotes-in-styles.svg diff --git a/testscour.py b/testscour.py index 8054371..50ad4e3 100755 --- a/testscour.py +++ b/testscour.py @@ -1818,6 +1818,17 @@ class HandleQuotesInAttributes(unittest.TestCase): 'Failed on attribute value with the same number of double quotes as single quotes') +class PreserveQuotesInStyles(unittest.TestCase): + + def runTest(self): + with open('unittests/quotes-in-styles.svg', "rb") as f: + output = scourString(f.read()) + self.assertTrue('use[id="t"]' in output, + 'Failed to preserve quote characters in a style element') + self.assertTrue("'Times New Roman'" in output, + 'Failed to preserve quote characters in a style attribute') + + class DoNotStripCommentsOutsideOfRoot(unittest.TestCase): def runTest(self): diff --git a/unittests/quotes-in-styles.svg b/unittests/quotes-in-styles.svg new file mode 100644 index 0000000..38a30f2 --- /dev/null +++ b/unittests/quotes-in-styles.svg @@ -0,0 +1,5 @@ + + + + +