aboutsummaryrefslogtreecommitdiff
path: root/tests/docx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-09-07 20:10:33 +0100
committerMichael Williamson <mike@zwobble.org>2015-09-07 20:10:33 +0100
commit224b5cf9c8b0fda519bcb11d8b8ac45775a3981b (patch)
tree90eead952ed7fb92b57ab6a8400e886b19964bbd /tests/docx
parentd1636badc0ef3a81009f77b9847e8c9bb0ecb951 (diff)
Test for error on trying to read relative URI when base is not set
Diffstat (limited to 'tests/docx')
-rw-r--r--tests/docx/files_tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/docx/files_tests.py b/tests/docx/files_tests.py
index 56dc69a..f6c0120 100644
--- a/tests/docx/files_tests.py
+++ b/tests/docx/files_tests.py
@@ -26,6 +26,16 @@ def can_open_files_with_relative_uri():
@istest
+def given_base_is_not_set_when_opening_relative_uri_then_error_is_raised():
+ files = Files(None)
+ error = assert_raises(InvalidFileReferenceError, lambda: files.open("not-a-real-file.png"))
+ expected_message = (
+ "could not find external image 'not-a-real-file.png', fileobj has no name"
+ )
+ assert_equal(expected_message, str(error))
+
+
+@istest
def error_is_raised_if_relative_uri_cannot_be_opened():
files = Files("/tmp")
error = assert_raises(InvalidFileReferenceError, lambda: files.open("not-a-real-file.png"))