def test_1010(self, gmn_client_v2): """PyXB accepts dt without tz for xs:dateTime types and returns it unmodified and without tz """ pid, sid, sciobj_bytes, sysmeta_pyxb, uploaded_dt, modified_dt = ( self._generate_sciobj(gmn_client_v2, 'naive')) # Starting with dt without tz assert not d1_common.date_time.has_tz(uploaded_dt) assert not d1_common.date_time.has_tz(modified_dt) # Reading the dts back from PyXB, they are still without tz assert not d1_common.date_time.has_tz(sysmeta_pyxb.dateUploaded) assert not d1_common.date_time.has_tz( sysmeta_pyxb.dateSysMetadataModified) # Generating the XML doc, the xs:dateTime strings are still without tz xml_doc = d1_common.xml.serialize_to_transport(sysmeta_pyxb) with d1_common.wrap.simple_xml.wrap(xml_doc) as xml: assert xml.get_element_dt('dateUploaded') == uploaded_dt assert xml.get_element_dt('dateSysMetadataModified') == modified_dt
def test_1090(self): """get_element_dt()""" with d1_common.wrap.simple_xml.wrap(self.sysmeta_xml) as xml: dt = xml.get_element_dt('dateUploaded') d1_common.date_time.are_equal( dt, datetime.datetime( 1933, 3, 3, 13, 13, 13, 333300, tzinfo=d1_common.date_time.FixedOffset( '-11:33', offset_hours=-11, offset_minutes=33 ) ) ) assert isinstance(dt, datetime.datetime)