kopia lustrzana https://github.com/glidernet/ogn-python
Corrected Beacon
rodzic
f416e9bfcd
commit
e7854411a3
|
@ -1,10 +1,9 @@
|
|||
from datetime import *
|
||||
import re
|
||||
|
||||
from sqlalchemy import Column, String, Integer, Float, DateTime
|
||||
from sqlalchemy.ext.declarative import AbstractConcreteBase
|
||||
|
||||
from ogn.aprs_utils import *
|
||||
from ogn.aprs_utils import createTimestamp, dmsToDeg, kts2kmh, feet2m
|
||||
from ogn.model.base import Base
|
||||
|
||||
|
||||
|
@ -24,8 +23,8 @@ class Beacon(AbstractConcreteBase, Base):
|
|||
symboltable = None
|
||||
longitude = Column(Float)
|
||||
symbolcode = None
|
||||
ground_speed = Column(Float)
|
||||
track = Column(Integer)
|
||||
ground_speed = Column(Float)
|
||||
altitude = Column(Integer)
|
||||
comment = None
|
||||
|
||||
|
@ -52,11 +51,11 @@ class Beacon(AbstractConcreteBase, Base):
|
|||
self.symbolcode = result.group(9)
|
||||
|
||||
if result.group(10) is not None:
|
||||
self.ground_speed = int(result.group(11))*kts2kmh
|
||||
self.track = int(result.group(12))
|
||||
self.track = int(result.group(11))
|
||||
self.ground_speed = int(result.group(12))*kts2kmh
|
||||
else:
|
||||
self.speed = 0
|
||||
self.track = 0
|
||||
self.ground_speed = 0
|
||||
|
||||
self.altitude = int(result.group(13))*feet2m
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import unittest
|
||||
|
||||
from ogn.aprs_utils import *
|
||||
from ogn.aprs_utils import dmsToDeg, kts2kmh, m2feet
|
||||
from ogn.model.beacon import Beacon
|
||||
|
||||
|
||||
|
@ -16,7 +16,8 @@ class TestStringMethods(unittest.TestCase):
|
|||
self.assertEqual(beacon.symboltable, '/')
|
||||
self.assertAlmostEqual(beacon.longitude, dmsToDeg(6.0003), 5)
|
||||
self.assertEqual(beacon.symbolcode, '\'')
|
||||
self.assertEqual(beacon.ground_speed, 342*kts2kmh)
|
||||
self.assertEqual(beacon.track, 342)
|
||||
self.assertEqual(beacon.ground_speed, 49*kts2kmh)
|
||||
self.assertAlmostEqual(beacon.altitude*m2feet, 5524, 5)
|
||||
self.assertEqual(beacon.comment, "this is a comment")
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue