fix timestamp in test_parse_position
This commit is contained in:
parent
ef88e3493a
commit
c2a0f18ce0
|
|
@ -3,3 +3,5 @@
|
|||
*.pyc
|
||||
dist
|
||||
*.egg-info
|
||||
env3
|
||||
env2
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import unittest
|
||||
from datetime import datetime
|
||||
|
||||
from aprslib.parsing import parse_position
|
||||
|
||||
|
|
@ -6,13 +7,18 @@ class ParsePositionDataExtAndWeather(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.maxDiff = None
|
||||
|
||||
def timestamp_from_partial(self, day, hour, minute):
|
||||
now = datetime.now()
|
||||
corrected = now.replace(day=day, hour=hour, minute=minute, second=0, microsecond=0)
|
||||
return int((corrected - datetime(1970, 1, 1)).total_seconds())
|
||||
|
||||
def test_position_packet_only_weather_valid(self):
|
||||
packet_type = '@'
|
||||
packet = "092345z4903.50N/07201.75W_g000t066r000p000...dUII"
|
||||
expected = {
|
||||
'messagecapable': True,
|
||||
'raw_timestamp': '092345z',
|
||||
'timestamp': 1657410300,
|
||||
'timestamp': self.timestamp_from_partial(9, 23, 45),
|
||||
'format': 'uncompressed',
|
||||
'posambiguity': 0,
|
||||
'symbol': '_',
|
||||
|
|
@ -37,7 +43,7 @@ class ParsePositionDataExtAndWeather(unittest.TestCase):
|
|||
expected = {
|
||||
'messagecapable': True,
|
||||
'raw_timestamp': '092345z',
|
||||
'timestamp': 1657410300,
|
||||
'timestamp': self.timestamp_from_partial(9, 23, 45),
|
||||
'format': 'uncompressed',
|
||||
'posambiguity': 0,
|
||||
'symbol': '_',
|
||||
|
|
@ -64,7 +70,7 @@ class ParsePositionDataExtAndWeather(unittest.TestCase):
|
|||
expected = {
|
||||
'messagecapable': True,
|
||||
'raw_timestamp': '092345z',
|
||||
'timestamp': 1657410300,
|
||||
'timestamp': self.timestamp_from_partial(9, 23, 45),
|
||||
'format': 'uncompressed',
|
||||
'posambiguity': 0,
|
||||
'symbol': '_',
|
||||
|
|
@ -90,7 +96,7 @@ class ParsePositionDataExtAndWeather(unittest.TestCase):
|
|||
expected = {
|
||||
'messagecapable': True,
|
||||
'raw_timestamp': '092345z',
|
||||
'timestamp': 1657410300,
|
||||
'timestamp': self.timestamp_from_partial(9, 23, 45),
|
||||
'format': 'uncompressed',
|
||||
'posambiguity': 0,
|
||||
'symbol': '_',
|
||||
|
|
@ -116,7 +122,7 @@ class ParsePositionDataExtAndWeather(unittest.TestCase):
|
|||
expected = {
|
||||
'messagecapable': True,
|
||||
'raw_timestamp': '092345z',
|
||||
'timestamp': 1657410300,
|
||||
'timestamp': self.timestamp_from_partial(9, 23, 45),
|
||||
'format': 'uncompressed',
|
||||
'posambiguity': 0,
|
||||
'symbol': '_',
|
||||
|
|
@ -140,7 +146,7 @@ class ParsePositionDataExtAndWeather(unittest.TestCase):
|
|||
expected = {
|
||||
'messagecapable': True,
|
||||
'raw_timestamp': '092345z',
|
||||
'timestamp': 1657410300,
|
||||
'timestamp': self.timestamp_from_partial(9, 23, 45),
|
||||
'format': 'uncompressed',
|
||||
'posambiguity': 0,
|
||||
'symbol': '_',
|
||||
|
|
|
|||
Loading…
Reference in New Issue