def test_time_inclusive_boundaries(self): test_model = Time.customize(ge=datetime.time(12, 00), le=datetime.time(13, 00)) self.assertTrue( test_model.validate_native(test_model, datetime.time(12, 00))) self.assertTrue( test_model.validate_native(test_model, datetime.time(13, 00)))
def test_time_exclusive_boundaries(self): test_model = Time.customize(gt=datetime.time(12, 00), lt=datetime.time(13, 00)) self.assertFalse( test_model.validate_native(test_model, datetime.time(12, 00))) self.assertFalse( test_model.validate_native(test_model, datetime.time(13, 00)))
def test_time_extreme_boundary(self): self.assertTrue(Time.validate_native(Time, datetime.time(0, 0, 0, 0))) self.assertTrue( Time.validate_native(Time, datetime.time(23, 59, 59, 999999)))
class InteropPrimitive(ServiceBase): @srpc(AnyXml, _returns=AnyXml) def echo_any(xml): return xml @srpc(AnyDict, _returns=AnyDict) def echo_any_as_dict(xml_as_dict): return xml_as_dict @srpc(Integer, _returns=Integer) def echo_integer(i): return i @srpc(String, _returns=String) def echo_string(s): return s @srpc(DateTime, _returns=DateTime) def echo_datetime(dt): return dt @srpc(DateTime(format='ignored'), _returns=DateTime) def echo_datetime_with_invalid_format(dt): return dt @srpc(Date, _returns=Date) def echo_date(d): return d @srpc(Date(format='ignored'), _returns=Date) def echo_date_with_invalid_format(d): return d @srpc(Time, _returns=Time) def echo_time(t): return t @srpc(Time(format='ignored'), _returns=Time) def echo_time_with_invalid_format(t): return t @srpc(Float, _returns=Float) def echo_float(f): return f @srpc(Double, _returns=Double) def echo_double(f): return f @srpc(Boolean, _returns=Boolean) def echo_boolean(b): return b @srpc(DaysOfWeekEnum, _returns=DaysOfWeekEnum) def echo_enum(day): return day @srpc(Duration, _returns=Duration) def echo_duration(dur): return dur @srpc(ByteArray, _returns=ByteArray) def echo_bytearray(data): return data