From 51e109968beb0c4f2fc4ac8524c3bbf1b74da369 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 12 Apr 2020 15:09:16 +0100 Subject: Only parse integer font sizes --- tests/docx/body_xml_tests.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py index 2258330..17d631d 100644 --- a/tests/docx/body_xml_tests.py +++ b/tests/docx/body_xml_tests.py @@ -336,6 +336,12 @@ class RunTests(object): run = self._read_run_with_properties([font_size_xml]) assert_equal(14, run.font_size) + @istest + def run_with_invalid_w_sz_has_none_font_size(self): + font_size_xml = xml_element("w:sz", {"w:val": "28a"}) + run = self._read_run_with_properties([font_size_xml]) + assert_equal(None, run.font_size) + def _read_run_with_properties(self, properties, styles=None): properties_xml = xml_element("w:rPr", {}, properties) run_xml = xml_element("w:r", {}, [properties_xml]) -- cgit v1.2.3