File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,10 +47,18 @@ class _Document(object):
4747 def __init__ (self , pkg , document_part ):
4848 super (_Document , self ).__init__ ()
4949 self ._document = document_part
50+ self ._pkg = pkg
5051
5152 @property
5253 def body (self ):
5354 """
5455 Return a reference to the |Body| instance for this document.
5556 """
5657 return self ._document .body
58+
59+ def save (self , file_ ):
60+ """
61+ Save this document to *file_*, where *file_* can be either a path to
62+ a file (a string) or a file-like object.
63+ """
64+ return self ._pkg .save (file_ )
Original file line number Diff line number Diff line change @@ -81,3 +81,8 @@ def it_provides_access_to_the_document_body(self):
8181 body = doc .body
8282 # verify -----------------------
8383 assert body is document_part .body
84+
85+ def it_can_save_the_package (self ):
86+ pkg , file_ = (Mock (name = 'pkg' ), Mock (name = 'file_' ))
87+ _Document (pkg , None ).save (file_ )
88+ pkg .save .assert_called_once_with (file_ )
You can’t perform that action at this time.
0 commit comments