def it_creates_a_new_notes_master_part_to_help( self, request, package_, notes_master_part_ ): NotesMasterPart_ = class_mock( request, "pptx.parts.slide.NotesMasterPart", return_value=notes_master_part_ ) notesMaster = element("p:notesMaster") method_mock( request, CT_NotesMaster, "new_default", autospec=False, return_value=notesMaster, ) notes_master_part = NotesMasterPart._new(package_) CT_NotesMaster.new_default.assert_called_once_with() NotesMasterPart_.assert_called_once_with( PackURI("/ppt/notesMasters/notesMaster1.xml"), CT.PML_NOTES_MASTER, package_, notesMaster, ) assert notes_master_part is notes_master_part_
def it_can_create_a_notes_master_part(self, create_fixture): package_, theme_part_, notes_master_part_ = create_fixture notes_master_part = NotesMasterPart.create_default(package_) NotesMasterPart._new.assert_called_once_with(package_) NotesMasterPart._new_theme_part.assert_called_once_with(package_) notes_master_part.relate_to.assert_called_once_with(theme_part_, RT.THEME) assert notes_master_part is notes_master_part_
def it_creates_a_new_notes_master_part_to_help(self, new_fixture): package_, NotesMasterPart_, partname = new_fixture[:3] notesMaster_, notes_master_part_ = new_fixture[3:] notes_master_part = NotesMasterPart._new(package_) CT_NotesMaster.new_default.assert_called_once_with() NotesMasterPart_.assert_called_once_with(partname, CT.PML_NOTES_MASTER, notesMaster_, package_) assert notes_master_part is notes_master_part_
def it_can_create_a_notes_master_part(self, create_fixture): package_, theme_part_, notes_master_part_ = create_fixture notes_master_part = NotesMasterPart.create_default(package_) NotesMasterPart._new.assert_called_once_with(package_) NotesMasterPart._new_theme_part.assert_called_once_with(package_) notes_master_part.relate_to.assert_called_once_with( theme_part_, RT.THEME) assert notes_master_part is notes_master_part_
def it_creates_a_new_theme_part_to_help(self, theme_fixture): package_, pn_tmpl, XmlPart_, partname = theme_fixture[:4] theme_elm_, theme_part_ = theme_fixture[4:] theme_part = NotesMasterPart._new_theme_part(package_) package_.next_partname.assert_called_once_with(pn_tmpl) CT_OfficeStyleSheet.new_default.assert_called_once_with() XmlPart_.assert_called_once_with(partname, CT.OFC_THEME, theme_elm_, package_) assert theme_part is theme_part_
def it_creates_a_new_theme_part_to_help(self, theme_fixture): package_, pn_tmpl, XmlPart_, partname = theme_fixture[:4] theme_elm_, theme_part_ = theme_fixture[4:] theme_part = NotesMasterPart._new_theme_part(package_) package_.next_partname.assert_called_once_with(pn_tmpl) CT_OfficeStyleSheet.new_default.assert_called_once_with() XmlPart_.assert_called_once_with(partname, CT.OFC_THEME, theme_elm_, package_) assert theme_part is theme_part_
def it_creates_a_new_notes_master_part_to_help(self, new_fixture): package_, NotesMasterPart_, partname = new_fixture[:3] notesMaster_, notes_master_part_ = new_fixture[3:] notes_master_part = NotesMasterPart._new(package_) CT_NotesMaster.new_default.assert_called_once_with() NotesMasterPart_.assert_called_once_with( partname, CT.PML_NOTES_MASTER, notesMaster_, package_ ) assert notes_master_part is notes_master_part_
def it_provides_access_to_its_notes_master(self, request): notes_master_ = instance_mock(request, NotesMaster) NotesMaster_ = class_mock( request, "pptx.parts.slide.NotesMaster", return_value=notes_master_ ) notesMaster = element("p:notesMaster") notes_master_part = NotesMasterPart(None, None, None, notesMaster) notes_master = notes_master_part.notes_master NotesMaster_.assert_called_once_with(notesMaster, notes_master_part) assert notes_master is notes_master_
def notes_master_part(self): """ Return the |NotesMasterPart| object for this presentation. If the presentation does not have a notes master, one is created from a default template. The same single instance is returned on each call. """ try: return self.part_related_by(RT.NOTES_MASTER) except KeyError: notes_master_part = NotesMasterPart.create_default(self.package) self.relate_to(notes_master_part, RT.NOTES_MASTER) return notes_master_part
def it_creates_a_new_theme_part_to_help(self, request, package_, theme_part_): XmlPart_ = class_mock( request, "pptx.parts.slide.XmlPart", return_value=theme_part_ ) theme_elm = element("p:theme") method_mock( request, CT_OfficeStyleSheet, "new_default", autospec=False, return_value=theme_elm, ) pn_tmpl = "/ppt/theme/theme%d.xml" partname = PackURI("/ppt/theme/theme2.xml") package_.next_partname.return_value = partname theme_part = NotesMasterPart._new_theme_part(package_) package_.next_partname.assert_called_once_with(pn_tmpl) CT_OfficeStyleSheet.new_default.assert_called_once_with() XmlPart_.assert_called_once_with(partname, CT.OFC_THEME, package_, theme_elm) assert theme_part is theme_part_
def it_can_create_a_notes_master_part( self, request, package_, notes_master_part_, theme_part_ ): method_mock( request, NotesMasterPart, "_new", autospec=False, return_value=notes_master_part_, ) method_mock( request, NotesMasterPart, "_new_theme_part", autospec=False, return_value=theme_part_, ) notes_master_part = NotesMasterPart.create_default(package_) NotesMasterPart._new.assert_called_once_with(package_) NotesMasterPart._new_theme_part.assert_called_once_with(package_) notes_master_part.relate_to.assert_called_once_with(theme_part_, RT.THEME) assert notes_master_part is notes_master_part_
def notes_master_fixture(self, NotesMaster_, notes_master_): notesMaster = element("p:notesMaster") notes_master_part = NotesMasterPart(None, None, notesMaster, None) return notes_master_part, NotesMaster_, notesMaster, notes_master_