From af24bdd0e8b67d2a0eaf053c7bf69a5b7c37639c Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 20 Aug 2015 21:29:06 +0100 Subject: Continue after any IOError while attempting to read image --- tests/mammoth_tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index aa70c1c..f29ae0f 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -96,8 +96,10 @@ def warn_if_images_stored_outside_of_document_are_not_found(): with open(document_path, "rb") as fileobj: result = mammoth.convert_to_html(fileobj=fileobj) assert_equal("", result.value) - expected_warning = "could not find external image 'tiny-picture.png' from document directory '{0}'".format(temp_dir.path) - assert_equal([results.warning(expected_warning)], result.messages) + expected_warning = "could not open external image 'tiny-picture.png' from document directory '{0}'\n[Errno 2] No such file or directory".format(temp_dir.path) + assert_equal("warning", result.messages[0].type) + assert result.messages[0].message.startswith(expected_warning), "message was: " + result.messages[0].message + assert_equal(1, len(result.messages)) @istest -- cgit v1.2.3