feat(2-4): implement altitude colour bands and aircraft type icons
Implements altitude_to_colour() mapping altitude bands to the 6 e-ink palette colours, and classify_aircraft_type() resolving ADS-B category, callsign prefix, and altitude fallback to AircraftType enum. Adds 21 new tests (13 parametrised boundary cases + 8 icon classification); 89 tests total, all quality gates green. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+45
-2
@@ -1,2 +1,45 @@
|
||||
def test_placeholder() -> None:
|
||||
pass
|
||||
from __future__ import annotations
|
||||
|
||||
from planemapper.models import Aircraft
|
||||
from planemapper.renderer.icons import AircraftType, classify_aircraft_type
|
||||
|
||||
|
||||
def _aircraft(**kwargs) -> Aircraft:
|
||||
defaults = {"icao": "ABC123", "lat": 53.0, "lon": -6.0}
|
||||
defaults.update(kwargs)
|
||||
return Aircraft(**defaults)
|
||||
|
||||
|
||||
def test_category_a1_returns_ga_light() -> None:
|
||||
ac = _aircraft(category="A1")
|
||||
assert classify_aircraft_type(ac) == AircraftType.GA_LIGHT
|
||||
|
||||
|
||||
def test_category_a7_returns_helicopter() -> None:
|
||||
ac = _aircraft(category="A7")
|
||||
assert classify_aircraft_type(ac) == AircraftType.HELICOPTER
|
||||
|
||||
|
||||
def test_ba_callsign_returns_commercial() -> None:
|
||||
ac = _aircraft(callsign="BAW123")
|
||||
assert classify_aircraft_type(ac) == AircraftType.COMMERCIAL
|
||||
|
||||
|
||||
def test_altitude_below_10000_returns_ga_light() -> None:
|
||||
ac = _aircraft(altitude_ft=5000)
|
||||
assert classify_aircraft_type(ac) == AircraftType.GA_LIGHT
|
||||
|
||||
|
||||
def test_altitude_18000_returns_private_jet() -> None:
|
||||
ac = _aircraft(altitude_ft=18000)
|
||||
assert classify_aircraft_type(ac) == AircraftType.PRIVATE_JET
|
||||
|
||||
|
||||
def test_altitude_38000_returns_airliner() -> None:
|
||||
ac = _aircraft(altitude_ft=38000)
|
||||
assert classify_aircraft_type(ac) == AircraftType.AIRLINER
|
||||
|
||||
|
||||
def test_category_a3_returns_commercial() -> None:
|
||||
ac = _aircraft(category="A3")
|
||||
assert classify_aircraft_type(ac) == AircraftType.COMMERCIAL
|
||||
|
||||
Reference in New Issue
Block a user