Skip to content

Commit

Permalink
Use the ISO time format from tlefile
Browse files Browse the repository at this point in the history
  • Loading branch information
pnuu committed Jan 30, 2020
1 parent dc7d575 commit 9854128
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pyorbital/tests/test_tlefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ def test_init(self):

def test_update_db(self):
"""Test updating database with new data."""
from pyorbital.tlefile import table_exists, SATID_TABLE
from pyorbital.tlefile import (table_exists, SATID_TABLE,
ISO_TIME_FORMAT)

# Get the column names
columns = [col.strip() for col in
Expand Down Expand Up @@ -329,8 +330,7 @@ def test_update_db(self):
# TLE
self.assertEqual(data[0][1], '\n'.join((line1, line2)))
# Date when the data were added should be close to current time
date_added = datetime.datetime.strptime(data[0][2],
"%Y-%m-%dT%H:%M:%S.%f")
date_added = datetime.datetime.strptime(data[0][2], ISO_TIME_FORMAT)
now = datetime.datetime.utcnow()
self.assertTrue((now - date_added).total_seconds() < 1.0)
# Source of the data
Expand All @@ -342,8 +342,7 @@ def test_update_db(self):
res = self.db.db.execute("select * from '%s'" % satid)
data = res.fetchall()
self.assertEqual(len(data), 1)
date_added2 = datetime.datetime.strptime(data[0][2],
"%Y-%m-%dT%H:%M:%S.%f")
date_added2 = datetime.datetime.strptime(data[0][2], ISO_TIME_FORMAT)
self.assertEqual(date_added, date_added2)
# Source of the data
self.assertTrue(data[0][3] == 'foo')
Expand Down

0 comments on commit 9854128

Please sign in to comment.