aboutsummaryrefslogtreecommitdiff
path: root/tests/docx/files_tests.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-07-20 18:57:46 +0100
committerMichael Williamson <mike@zwobble.org>2015-07-20 18:58:15 +0100
commit61cf58387f239633bf1b81f4e8252459152d2598 (patch)
tree99aaf0469c35a330a973618dc5f7cb176cb14e18 /tests/docx/files_tests.py
parent3d20b52a4105d48e319493adf2481cdb5985f72d (diff)
Support linked images
Diffstat (limited to 'tests/docx/files_tests.py')
-rw-r--r--tests/docx/files_tests.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/docx/files_tests.py b/tests/docx/files_tests.py
new file mode 100644
index 0000000..c1e15dc
--- /dev/null
+++ b/tests/docx/files_tests.py
@@ -0,0 +1,25 @@
+from nose.tools import istest, assert_equal
+
+from mammoth.docx.files import Files
+from ..testing import test_path
+
+
+@istest
+def can_open_files_with_file_uri():
+ path = test_path("tiny-picture.png")
+ files = Files(None)
+ with files.open("file:///" + path) as image_file:
+ contents = image_file.read()
+ assert_equal(bytes, type(contents))
+ with open(path, "rb") as source_file:
+ assert_equal(source_file.read(), contents)
+
+
+@istest
+def can_open_files_with_relative_uri():
+ files = Files(test_path(""))
+ with files.open("tiny-picture.png") as image_file:
+ contents = image_file.read()
+ assert_equal(bytes, type(contents))
+ with open(test_path("tiny-picture.png"), "rb") as source_file:
+ assert_equal(source_file.read(), contents)