kopia lustrzana https://github.com/glidernet/ogn-python
Fix string representation of models
rodzic
825765fd26
commit
3b074ff0b1
|
@ -34,7 +34,7 @@ class AircraftBeacon(Beacon):
|
||||||
device = relationship('Device', foreign_keys=[device_id])
|
device = relationship('Device', foreign_keys=[device_id])
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<AircraftBeacon %s: %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s>" % (
|
return "<AircraftBeacon %s: %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s>" % (
|
||||||
self.address_type,
|
self.address_type,
|
||||||
self.aircraft_type,
|
self.aircraft_type,
|
||||||
self.stealth,
|
self.stealth,
|
||||||
|
|
|
@ -32,8 +32,8 @@ class Airport(Base):
|
||||||
self.country_code,
|
self.country_code,
|
||||||
self.style,
|
self.style,
|
||||||
self.description,
|
self.description,
|
||||||
self.latitude,
|
self.location_wkt.latitude if self.location_wkt else None,
|
||||||
self.longitude,
|
self.location_wkt.longitude if self.location_wkt else None,
|
||||||
self.altitude,
|
self.altitude,
|
||||||
self.runway_direction,
|
self.runway_direction,
|
||||||
self.runway_length,
|
self.runway_length,
|
||||||
|
|
|
@ -36,7 +36,7 @@ class ReceiverBeacon(Beacon):
|
||||||
receiver = relationship('Receiver', foreign_keys=[receiver_id])
|
receiver = relationship('Receiver', foreign_keys=[receiver_id])
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<ReceiverBeacon %s: %s>" % (
|
return "<ReceiverBeacon %s: %s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s>" % (
|
||||||
self.version,
|
self.version,
|
||||||
self.platform,
|
self.platform,
|
||||||
self.cpu_load,
|
self.cpu_load,
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from ogn.model import AircraftBeacon, Airport, ReceiverBeacon
|
||||||
|
|
||||||
|
|
||||||
|
class TestStringMethods(unittest.TestCase):
|
||||||
|
def test_string(self):
|
||||||
|
print(AircraftBeacon())
|
||||||
|
print(Airport())
|
||||||
|
print(ReceiverBeacon())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
Ładowanie…
Reference in New Issue