예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
 def coreprops_fixture(self, element_, CoreProperties_):
     core_properties_part = CorePropertiesPart(None, None, element_, None)
     return core_properties_part, CoreProperties_