Esempio n. 1
0
 def _default(cls):
     core_props = _CoreProperties('/docProps/core.xml')
     core_props._element = CT_CoreProperties.new_coreProperties()
     core_props.title = 'PowerPoint Presentation'
     core_props.last_modified_by = 'python-pptx'
     core_props.revision = 1
     core_props.modified = datetime.utcnow()
     return core_props
Esempio n. 2
0
 def test_date_parser_recognizes_W3CDTF_strings(self):
     """date parser recognizes W3CDTF formatted date strings"""
     # valid W3CDTF date cases:
     # yyyy e.g. '2003'
     # yyyy-mm e.g. '2003-12'
     # yyyy-mm-dd e.g. '2003-12-31'
     # UTC timezone e.g. '2003-12-31T10:14:55Z'
     # numeric timezone e.g. '2003-12-31T10:14:55-08:00'
     cases = (
         ("1999", datetime(1999, 1, 1, 0, 0, 0)),
         ("2000-02", datetime(2000, 2, 1, 0, 0, 0)),
         ("2001-03-04", datetime(2001, 3, 4, 0, 0, 0)),
         ("2002-05-06T01:23:45Z", datetime(2002, 5, 6, 1, 23, 45)),
         ("2013-06-16T22:34:56-07:00", datetime(2013, 6, 17, 5, 34, 56)),
     )
     for dt_str, expected_datetime in cases:
         # exercise -----------------
         dt = CT_CoreProperties._parse_W3CDTF_to_datetime(dt_str)
         # verify -------------------
         assert_that(dt, is_(expected_datetime))