_E(_ET.SCALAR, _IT.STRING, 42) ], expected=TypeError ), _P( desc="IVM EVENT", # The IVM is handled by the managed binary writer. events=[ _E(_ET.VERSION_MARKER) ], expected=TypeError ), _P( desc="INSUFFICIENT TIMESTAMP PRECISION", events=[ _E(_ET.SCALAR, _IT.TIMESTAMP, timestamp(1, 1, 1, 1, 1, 1, 123456, precision=TimestampPrecision.SECOND, fractional_precision=3)) ], expected=ValueError ) ] _SIMPLE_CONTAINER_MAP = { _IT.LIST: ( ( (), b'\xB0' ), ( (_E(_ET.SCALAR, _IT.INT, 0),), bytearray([ 0xB0 | 0x01, # Int value 0 fits in 1 byte.
(_D("0e1"), b'\x51\x81'), (_D("-1e1"), b'\x52\x81\x81'), (_D("-1e0"), b'\x52\x80\x81'), (_D("-1e-1"), b'\x52\xC1\x81'), (_D("-0e-1"), b'\x52\xC1\x80'), (_D("-0e1"), b'\x52\x81\x80'), ), _IT.TIMESTAMP: ( (None, b'\x6F'), # TODO Clarify whether there's a valid zero-length Timestamp representation. (_DT(year=1, month=1, day=1), b'\x68\xC0\x81\x81\x81\x80\x80\x80\xc6'), (_DT(year=1, month=1, day=1, tzinfo=OffsetTZInfo(timedelta(minutes=-1))), b'\x68\xC1\x81\x81\x81\x80\x81\x80\xc6'), (_DT(year=1, month=1, day=1, hour=0, minute=0, second=0, microsecond=1), b'\x69\xC0\x81\x81\x81\x80\x80\x80\xC6\x01'), (timestamp(year=1, month=1, day=1, precision=TimestampPrecision.DAY), b'\x64\xC0\x81\x81\x81'), (timestamp(year=1, month=1, day=1, off_minutes=-1, precision=TimestampPrecision.SECOND), b'\x67\xC1\x81\x81\x81\x80\x81\x80'), ( timestamp(year=1, month=1, day=1, hour=0, minute=0, second=0, microsecond=1, precision=TimestampPrecision.SECOND), b'\x69\xC0\x81\x81\x81\x80\x80\x80\xC6\x01' ), ( timestamp(year=1, month=1, day=1, hour=0, minute=0, second=0, microsecond=100000, precision=TimestampPrecision.SECOND, fractional_precision=1), b'\x69\xC0\x81\x81\x81\x80\x80\x80\xC1\x01' ), (timestamp(2016, precision=TimestampPrecision.YEAR), b'\x63\xC0\x0F\xE0'), # -00:00 (timestamp(2016, off_hours=0, precision=TimestampPrecision.YEAR), b'\x63\x80\x0F\xE0'), (
(_D("-1e-1"), b'\x52\xC1\x81'), (_D("-0e-1"), b'\x52\xC1\x80'), (_D("-0e1"), b'\x52\x81\x80'), ), _IT.TIMESTAMP: ( (None, b'\x6F'), # TODO Clarify whether there's a valid zero-length Timestamp representation. (_DT(year=1, month=1, day=1), b'\x68\xC0\x81\x81\x81\x80\x80\x80\xc6'), (_DT(year=1, month=1, day=1, tzinfo=OffsetTZInfo(timedelta(minutes=-1))), b'\x68\xC1\x81\x81\x81\x80\x81\x80\xc6'), (_DT(year=1, month=1, day=1, hour=0, minute=0, second=0, microsecond=1), b'\x69\xC0\x81\x81\x81\x80\x80\x80\xC6\x01'), (timestamp(year=1, month=1, day=1, precision=TimestampPrecision.DAY), b'\x64\xC0\x81\x81\x81'), (timestamp(year=1, month=1, day=1, off_minutes=-1, precision=TimestampPrecision.SECOND), b'\x67\xC1\x81\x81\x81\x80\x81\x80'), (timestamp(year=1, month=1, day=1, hour=0, minute=0, second=0, microsecond=1, precision=TimestampPrecision.SECOND), b'\x69\xC0\x81\x81\x81\x80\x80\x80\xC6\x01'),
(_D('-4.412111311414141e1000'), b'-4.412111311414141d+1000'), (_D('1.1999999999999999555910790149937383830547332763671875e0'), b'1.1999999999999999555910790149937383830547332763671875'), ), _IT.TIMESTAMP: ( (None, b'null.timestamp'), (_DT(2016, 1, 1), b'2016-01-01T00:00:00.000000-00:00'), (_DT(2016, 1, 1, 12), b'2016-01-01T12:00:00.000000-00:00'), (_DT(2016, 1, 1, 12, 34, 12), b'2016-01-01T12:34:12.000000-00:00'), (_DT(2016, 1, 1, 12, 34, 12, 555000), b'2016-01-01T12:34:12.555000-00:00'), (_DT(2016, 1, 1, 12, 34, 12, tzinfo=OffsetTZInfo()), b'2016-01-01T12:34:12.000000Z'), (_DT(2016, 1, 1, 12, 34, 12, tzinfo=OffsetTZInfo(timedelta(hours=-7))), b'2016-01-01T12:34:12.000000-07:00'), (timestamp(year=1, month=1, day=1, precision=TimestampPrecision.DAY), b'0001-01-01T'), (timestamp(year=1, month=1, day=1, off_minutes=-1, precision=TimestampPrecision.SECOND), b'0001-01-01T00:00:00-00:01'), (timestamp(year=1, month=1, day=1, hour=0, minute=0, second=0, microsecond=1, precision=TimestampPrecision.SECOND), b'0001-01-01T00:00:00.000001-00:00'),