blob: c1e15dcb8e6fb81909a03d697c20a6c107a47ee7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
|