def test_decode_timestamp_in_previous_month(): # Fake the date, ensure we get returned the previous month with mock.patch('aprspy.utils.APRSUtils._get_utc', return_value=datetime(2019, 10, 10)): timestamp, timestamp_type = APRSUtils.decode_timestamp("302345z") assert timestamp.day == 30 assert timestamp.month == 9
def test_decode_timestamp_hms_time(): timestamp, timestamp_type = APRSUtils.decode_timestamp("234517h") assert type(timestamp) == datetime assert timestamp_type == "hms" assert timestamp.hour == 23 assert timestamp.minute == 45 assert timestamp.second == 17
def test_decode_timestamp_local_time(): timestamp, timestamp_type = APRSUtils.decode_timestamp("092345/") assert type(timestamp) == datetime assert timestamp_type == "local" assert timestamp.day == 9 assert timestamp.hour == 23 assert timestamp.minute == 45
def test_timestamp(): timestamp = APRSUtils.decode_timestamp("091234z")
def test_decode_timestamp_hms_invalid_time_value(): with pytest.raises(ParseError): APRSUtils.decode_timestamp("254517h")
def test_decode_timestamp_zulu_invalid_time_value(): with pytest.raises(ParseError): APRSUtils.decode_timestamp("322345z")