Skip to content

Commit 7ef0bd8

Browse files
author
Steve Canny
committed
broken: refactor _Document.load() to new signature
1 parent 041d901 commit 7ef0bd8

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

docx/parts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class _Document(Part):
2020
"""
2121
Main document part of a WordprocessingML (WML) package, aka a .docx file.
2222
"""
23-
def __init__(self, document_elm):
23+
def __init__(self, partname, content_type, document_elm):
24+
super(_Document, self).__init__(partname, content_type)
2425
self._element = document_elm
2526

2627
@property
@@ -32,6 +33,5 @@ def body(self):
3233
@staticmethod
3334
def load(partname, content_type, blob):
3435
document_elm = oxml_fromstring(blob)
35-
document = _Document(document_elm)
36-
super(_Document, document).__init__(partname, content_type)
36+
document = _Document(partname, content_type, document_elm)
3737
return document

tests/test_parts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ def it_can_be_constructed_by_opc_part_factory(self, oxml_fromstring_,
4040
doc = _Document.load(partname, content_type, blob)
4141
# verify -----------------------
4242
oxml_fromstring_.assert_called_once_with(blob)
43-
init.assert_called_once_with(document_elm)
43+
init.assert_called_once_with(partname, content_type, document_elm)
4444
assert isinstance(doc, _Document)

0 commit comments

Comments
 (0)