def test_copy_constructor(self): beacon = Beacon() beacon.parse("FLRDDA5BA>APRS,qAS,LFMX:/160829h4415.41N/00600.03E'342/049/A=005524 id0ADDA5BA -454fpm -1.1rot 8.8dB 0e +51.2kHz gps4x5") aircraft_beacon = AircraftBeacon(beacon) self.assertEqual(aircraft_beacon.name, 'FLRDDA5BA') self.assertEqual(aircraft_beacon.address, 'DDA5BA')
def test_basic(self): beacon = Beacon() beacon.parse("FLRDDA5BA>APRS,qAS,LFMX:/160829h4415.41N/00600.03E'342/049/A=005524 this is a comment") self.assertEqual(beacon.name, "FLRDDA5BA") self.assertEqual(beacon.receiver_name, "LFMX") self.assertEqual(beacon.timestamp.strftime('%H:%M:%S'), "16:08:29") self.assertAlmostEqual(beacon.latitude, dmsToDeg(44.1541), 5) self.assertEqual(beacon.symboltable, '/') self.assertAlmostEqual(beacon.longitude, dmsToDeg(6.0003), 5) self.assertEqual(beacon.symbolcode, '\'') 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")
def test_fail_validation(self): beacon = Beacon() with self.assertRaises(AprsParseError): beacon.parse("notAValidString")