Skip to content

Commit 3248fc7

Browse files
author
Jason Ward
committed
refs #54: Added a test showing expected behaviour
1 parent 4752e21 commit 3248fc7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pydocx/tests/test_docx.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import base64
2-
32
from os import path
3+
from tempfile import NamedTemporaryFile
44

55
from nose.plugins.skip import SkipTest
66

77
from pydocx.tests import assert_html_equal, BASE_HTML
88
from pydocx.parsers.Docx2Html import Docx2Html
99
from pydocx.DocxParser import ZipFile
10+
from pydocx.exceptions import MalformedDocxException
1011

1112

1213
def convert(path, *args, **kwargs):
@@ -749,6 +750,15 @@ def test_missing_numbering():
749750
''')
750751

751752

753+
def test_malformed_docx_exception():
754+
with NamedTemporaryFile(suffix='.docx') as f:
755+
try:
756+
convert(f.name)
757+
raise AssertionError('MalformedDocxException was not raised')
758+
except MalformedDocxException:
759+
pass
760+
761+
752762
def _converter(*args, **kwargs):
753763
# Having a converter that does nothing is the same as if abiword fails to
754764
# convert.

0 commit comments

Comments
 (0)