diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-12-03 18:02:13 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-12-03 18:02:13 +0000 |
| commit | 2cbb7baa6615835b7d4cb81dd2300569c0bafd4a (patch) | |
| tree | 3d59006b1728045eebdfedda13a82461d235e6fb /tests/docx | |
| parent | 61bc4fdd82a04da73aa61a5416ac2fa65fb9e237 (diff) | |
Read default content types
Diffstat (limited to 'tests/docx')
| -rw-r--r-- | tests/docx/content_types_xml_tests.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/docx/content_types_xml_tests.py b/tests/docx/content_types_xml_tests.py new file mode 100644 index 0000000..56b5a86 --- /dev/null +++ b/tests/docx/content_types_xml_tests.py @@ -0,0 +1,19 @@ +from nose.tools import istest, assert_equal + +from mammoth.docx.xmlparser import element as xml_element +from mammoth.docx.content_types_xml import read_content_types_xml_element + + +@istest +def content_type_is_based_on_default_for_extension_if_there_is_no_override(): + element = xml_element("content-types:Types", {}, [ + xml_element("content-types:Default", { + "Extension": "png", + "ContentType": "image/png", + }) + ]) + content_types = read_content_types_xml_element(element) + assert_equal( + "image/png", + content_types.find_content_type("word/media/hat.png"), + ) |
