def test_time_to_string(): time = Time(0, 0, 0) assert time.to_string() is not None assert time.to_string(Time.Format.Standard) is not None assert time.to_string(Time.Format.ISO8601) is not None
def test_time_parse(): ## Using python strings # Testing with default format argument (Time::Format::Undefined) time: Time = Time.parse('00:00:00') assert time is not None assert isinstance(time, Time) assert time.is_defined() # Testing with Time.Format.Standard time: Time = Time.parse('00:00:00', Time.Format.Standard) assert time is not None assert isinstance(time, Time) assert time.is_defined() # Testing with Time.Format.ISO8601 time: Time = Time.parse('00:00:00', Time.Format.ISO8601) assert time is not None assert isinstance(time, Time) assert time.is_defined() ## Using String class # Testing with default format argument (Time::Format::Undefined) time: Time = Time.parse(String('00:00:00')) assert time is not None assert isinstance(time, Time) assert time.is_defined() # Testing with Time.Format.Standard time: Time = Time.parse(String('00:00:00'), Time.Format.Standard) assert time is not None assert isinstance(time, Time) assert time.is_defined() # Testing with Time.Format.ISO8601 time: Time = Time.parse(String('00:00:00'), Time.Format.ISO8601) assert time is not None assert isinstance(time, Time) assert time.is_defined()
def test_date_time_constructors(): # Construction with 6 integers in input date_time: DateTime = DateTime(2020, 1, 1, 0, 0, 0, 0, 0, 0) assert date_time is not None assert isinstance(date_time, DateTime) assert date_time.is_defined() # Construction with 9 integers in input date_time: DateTime = DateTime(2020, 1, 1, 0, 0, 0) assert date_time is not None assert isinstance(date_time, DateTime) assert date_time.is_defined() # Construction with Date and Time objects date_time: DateTime = DateTime(Date(2020, 1, 1), Time(0, 0, 0)) assert date_time is not None assert isinstance(date_time, DateTime) assert date_time.is_defined()
def test_time_set_nanosecond(): time = Time(0, 0, 0) time.set_nanosecond(1)
def test_time_set_microsecond(): time = Time(0, 0, 0) time.set_microsecond(1)
def test_time_set_minute(): time = Time(0, 0, 0) time.set_minute(1)
def test_time_set_hour(): time = Time(0, 0, 0) time.set_hour(1)
def test_time_noon(): assert Time.noon() is not None
def test_time_get_nanosecond(): time = Time(0, 0, 0) assert time.get_nanosecond() is not None
def test_time_get_minute(): time = Time(0, 0, 0) assert time.get_minute() is not None
def test_time_get_hour(): time = Time(0, 0, 0) assert time.get_hour() is not None
def test_time_is_defined(): time = Time(0, 0, 0) assert time.is_defined() is not None
def test_time_operators(): time = Time(0, 0, 0) assert (time == time) is not None assert (time != time) is not None
def test_time_parse(): assert Time.parse('00:00:00') is not None assert Time.parse('00:00:00', Time.Format.Standard) is not None assert Time.parse('00:00:00', Time.Format.ISO8601) is not None
def test_date_time_get_time(): date_time = DateTime(2018, 1, 1, 0, 0, 0, 0, 0, 0) assert date_time.get_time() is not None assert date_time.get_time() == Time(0, 0, 0, 0, 0, 0)
def test_time_undefined(): assert Time.undefined() is not None
def test_time_midnight(): assert Time.midnight() is not None
def test_time_constructors(): assert Time(0, 0, 0) is not None
def test_time_get_floating_seconds(): time = Time(0, 0, 0) assert time.get_floating_seconds() is not None
def test_date_time_constructors (): assert DateTime(2018, 1, 1, 0, 0, 0, 0, 0, 0) is not None assert DateTime(2018, 1, 1, 0, 0, 0) is not None assert DateTime(Date(2018, 1, 1), Time(0, 0, 0)) is not None