diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-10-04 21:58:35 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-10-04 21:58:35 +0100 |
| commit | bf658f8747fbea1509ff30ca0adb374aece916cc (patch) | |
| tree | bf368fcc9bc6c7110cfe51386243e0869a653c9b /tests/docx | |
| parent | 1a71c66575ccc752b8feecdcf7187387a03155cb (diff) | |
Treat 0 as false in boolean elements
Diffstat (limited to 'tests/docx')
| -rw-r--r-- | tests/docx/body_xml_tests.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/docx/body_xml_tests.py b/tests/docx/body_xml_tests.py index 3024bde..ccbd888 100644 --- a/tests/docx/body_xml_tests.py +++ b/tests/docx/body_xml_tests.py @@ -189,14 +189,24 @@ class ReadXmlElementTests(object): ])(istest(func)) @run_boolean_property_test + def run_boolean_property_is_false_if_element_is_present_and_val_is_false(self, attr_name, tag_name): + run = self._read_run_with_properties([xml_element(tag_name, {"w:val": "false"})]) + assert_equal(False, getattr(run, attr_name)) + + @run_boolean_property_test + def run_boolean_property_is_false_if_element_is_present_and_val_is_0(self, attr_name, tag_name): + run = self._read_run_with_properties([xml_element(tag_name, {"w:val": "0"})]) + assert_equal(False, getattr(run, attr_name)) + + @run_boolean_property_test def run_boolean_property_is_true_if_element_is_present_and_val_is_true(self, attr_name, tag_name): run = self._read_run_with_properties([xml_element(tag_name, {"w:val": "true"})]) assert_equal(True, getattr(run, attr_name)) @run_boolean_property_test - def run_boolean_property_is_false_if_element_is_present_and_val_is_false(self, attr_name, tag_name): - run = self._read_run_with_properties([xml_element(tag_name, {"w:val": "false"})]) - assert_equal(False, getattr(run, attr_name)) + def run_boolean_property_is_true_if_element_is_present_and_val_is_1(self, attr_name, tag_name): + run = self._read_run_with_properties([xml_element(tag_name, {"w:val": "1"})]) + assert_equal(True, getattr(run, attr_name)) @istest def run_has_baseline_vertical_alignment_if_vertical_alignment_element_is_not_present(self): |
