def _new(cls, package): """Return new empty |CorePropertiesPart| instance.""" return CorePropertiesPart( PackURI("/docProps/core.xml"), CT.OPC_CORE_PROPERTIES, package, CT_CoreProperties.new_coreProperties(), )
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))
def _new(cls): partname = PackURI('/docProps/core.xml') content_type = CT.OPC_CORE_PROPERTIES core_props_elm = CT_CoreProperties.new_coreProperties() return CoreProperties(partname, content_type, core_props_elm)