コード例 #1
0
 def it_opens_default_template_if_no_file_provided(
         self, Package_, default_docx_):
     Document._open(None)
     Package_.open.assert_called_once_with(default_docx_)
コード例 #2
0
 def it_should_raise_if_not_a_Word_file(self, Package_, package_, docx_):
     package_.main_document.content_type = 'foobar'
     with pytest.raises(ValueError):
         Document._open(docx_)
コード例 #3
0
 def it_can_open_a_docx_file(self, open_fixture):
     docx_, Package_, package_, document_part_ = open_fixture
     document_part, package = Document._open(docx_)
     Package_.open.assert_called_once_with(docx_)
     assert document_part is document_part
     assert package is package_