def it_can_create_a_default_core_properties_part(self): core_properties_part = CorePropertiesPart.default(None) assert isinstance(core_properties_part, CorePropertiesPart) core_properties = core_properties_part.core_properties assert core_properties.title == 'Word Document' assert core_properties.last_modified_by == 'python-docx' assert core_properties.revision == 1 delta = datetime.utcnow() - core_properties.modified max_expected_delta = timedelta(seconds=2) assert delta < max_expected_delta
def _core_properties_part(self): """ |CorePropertiesPart| object related to this package. Creates a default core properties part if one is not present (not common). """ try: return self.part_related_by(RT.CORE_PROPERTIES) except KeyError: core_properties_part = CorePropertiesPart.default(self) self.relate_to(core_properties_part, RT.CORE_PROPERTIES) return core_properties_part
def coreprops_fixture(self, element_, CoreProperties_): core_properties_part = CorePropertiesPart(None, None, element_, None) return core_properties_part, CoreProperties_