Give the aerodromes a colour of their own, and say what each aircraft is
Four things about the animated pictures, and the window kept in step with them. The aerodromes were amber, and so is an aeroplane at twelve thousand feet. Sixteen units of CIELAB apart is not two colours, it is one: an aircraft low over a field was drawn in the field's own colour and neither could be picked out from the other. They are magenta now, fifty-six units from the nearest altitude colour, which is what the ramp leaves free once red, amber, green, cyan and violet have gone on height -- and what an aeronautical chart marks an aerodrome in anyway. The test states that as the distance rather than as the colour, so that changing the ramp cannot quietly walk an aircraft back into the airports. The height beside an aircraft was the flight level, which is shorter and is what an aviator reads, but "376" is only a height to somebody who already knows it is one. It is feet with the unit on it now, rounded to the twenty-five feet Mode S reports altitude in: a real reading is a multiple of that and comes through untouched, while a moment interpolated between two reports stops claiming to know the height to the foot. The flag of the country of registration now comes off the address block where no register answered. Taking it from the register's answer alone left the flag off exactly the aircraft that had nothing else beside them either. Mexico was missing from the address table while we were in there, which a receiver in the American southwest notices; two registers independently give XA- registrations for that block. And what sort of aircraft it is, which is two facts and not one. What it is comes off the air: every identification message carries three bits under its type code saying whether it is light, large, heavy, a rotorcraft, a glider, a drone or a van on the apron, and that is the only word about what an aircraft *is* that needs no register. They were being decoded and thrown away. They are inside the identification frame the log already writes down in full, so every log this program has ever written has them, including the ones written before anything here knew to look. Whether it is military comes off no air at all -- a tanker calls itself heavy exactly as an airliner does -- and is read from the address block instead. On one evening here AE07D3 broadcast "heavy" and sat in the United States military block; the register, asked separately, came back with a C-17A Globemaster III, tail 90-0534, United States Air Force. Labels in an animation now behave as the boxes in the window do. One keeps its place for as long as that place still works and is moved only when something takes it, which on a real log is about half as many moves as deciding afresh every frame; the moves that are left are eased over half a second of playback; and what the next label is laid out against is where a moving one is going rather than where it has reached. A still has no frame before it and places its labels exactly as it always did. The fading was only half done. A label's name faded, because it is drawn in the aircraft's own colour, but its rows and its flag were fixed colours and stayed at full brightness -- so the brightest thing on that part of the picture was the one aeroplane nothing had been heard from. An indexed picture cannot blend, so the row grey and all twelve flag colours now have dimmed copies at each of the four fade steps, and the whole box goes together. A crowded frame, which drops back to the short label, drops the class and the flag with it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016PsWPTweCT6pwxKngvVxcg
This commit is contained in:
parent
8eb3bdbb86
commit
f9b21f7e35
13 changed files with 1616 additions and 67 deletions
|
|
@ -278,3 +278,45 @@ def test_the_unit_reaches_the_display_from_the_options():
|
|||
finally:
|
||||
if live is not None:
|
||||
live.stop()
|
||||
|
||||
|
||||
def test_the_emitter_category_is_kept_as_the_frames_arrive():
|
||||
"""It comes off the air in the identification message, alongside the
|
||||
callsign, and is the only word about what an aircraft *is* that does
|
||||
not need a register."""
|
||||
import binascii
|
||||
|
||||
from bandsaunter.adsb import _read, category_name
|
||||
|
||||
# A real identification frame: type code 4, category 3.
|
||||
raw = binascii.unhexlify("8DA80A97234CB5F5CF4C604EB016")
|
||||
frame = _read("".join(f"{b:08b}" for b in raw), raw)
|
||||
assert (frame.type_code, frame.category) == (4, 3)
|
||||
assert category_name(4, 3) == "large"
|
||||
|
||||
reg = AircraftRegistry()
|
||||
craft = reg.add(frame, when=1.0)
|
||||
assert craft.category == "large"
|
||||
|
||||
|
||||
def test_an_aircraft_that_declines_to_say_is_not_given_a_category():
|
||||
from bandsaunter.adsb import Frame, category_name
|
||||
|
||||
assert category_name(4, 0) == "" # zero means "not saying"
|
||||
assert category_name(9, 3) == "" # not an identification message
|
||||
reg = AircraftRegistry()
|
||||
craft = reg.add(Frame(icao="ABCDEF", type_code=4, category=0), when=1.0)
|
||||
assert craft.category == ""
|
||||
|
||||
|
||||
def test_the_same_three_bits_mean_different_things_under_different_codes():
|
||||
"""Which list they index depends on the type code, which is why it is a
|
||||
table of tables: category 1 is a light aeroplane under type 4 and a
|
||||
glider under type 3."""
|
||||
from bandsaunter.adsb import category_name
|
||||
|
||||
assert category_name(4, 1) == "light"
|
||||
assert category_name(3, 1) == "glider"
|
||||
assert category_name(2, 1) == "emergency vehicle"
|
||||
assert category_name(4, 7) == "rotorcraft"
|
||||
assert category_name(3, 7) == "spacecraft"
|
||||
|
|
|
|||
|
|
@ -763,7 +763,9 @@ def test_the_label_says_height_speed_type_and_both_ends_of_the_route():
|
|||
track = straight()
|
||||
rows = fm.label_lines(track, track.fixes[0], "knots", _Entry())
|
||||
text = [line for line, _flag in rows]
|
||||
assert text[0].startswith("350") # flight level
|
||||
# The height in feet with its unit on it: "350" is only a height to
|
||||
# somebody who already knows it is one.
|
||||
assert text[0].startswith("35,000 ft")
|
||||
assert "480KT" in text[0]
|
||||
assert "B739 N904DN" in text
|
||||
assert "KATL" in text and "EGLL" in text
|
||||
|
|
@ -778,9 +780,24 @@ def test_each_end_of_the_route_carries_its_own_country():
|
|||
|
||||
|
||||
def test_with_no_register_the_label_is_what_the_aircraft_itself_said():
|
||||
"""The height and the speed, which came off the air, and the flag of the
|
||||
country that issued the address, which needs no register either."""
|
||||
track = straight()
|
||||
rows = fm.label_lines(track, track.fixes[0], "knots", None)
|
||||
assert len(rows) == 1 and rows[0][1] == ""
|
||||
assert rows[0][0].startswith("35,000 ft") and rows[0][1] == ""
|
||||
assert [flag for _text, flag in rows if flag] == ["IE"]
|
||||
assert not any("N904DN" in text for text, _flag in rows)
|
||||
|
||||
|
||||
def test_the_flag_is_there_for_an_aircraft_no_register_has_heard_of():
|
||||
"""Taking the country from the register's answer left the flag off
|
||||
exactly the aircraft that had nothing else beside them either. The
|
||||
address block says it without asking anybody."""
|
||||
for icao, expected in (("4CA1FA", "IE"), ("A12345", "US"),
|
||||
("0D0468", "MX"), ("406B12", "GB")):
|
||||
track = straight(icao=icao)
|
||||
rows = fm.label_lines(track, track.fixes[0], "knots", None)
|
||||
assert [flag for _text, flag in rows if flag] == [expected], icao
|
||||
|
||||
|
||||
def test_an_airport_with_no_code_is_named_short_rather_than_in_full():
|
||||
|
|
@ -861,11 +878,28 @@ def test_the_route_reaches_the_drawn_picture(tmp_path):
|
|||
known = {t.icao: _Entry() for t in tracks}
|
||||
frame = fm.render_frame(base, view, tracks, tracks[0].first_seen + 60,
|
||||
known=known)
|
||||
assert (frame >= fm.FLAG).any(), "no flag was drawn"
|
||||
assert _has_flag(frame), "no flag was drawn"
|
||||
assert _has_text(frame, "KATL")
|
||||
assert _has_text(frame, "B739")
|
||||
|
||||
|
||||
def _has_flag(frame) -> bool:
|
||||
"""Whether any flag was drawn: its own colours, at any fade step.
|
||||
|
||||
Checked by the exact palette ranges rather than "any index above the
|
||||
flags", because everything a fading label is drawn in lives above them
|
||||
too.
|
||||
"""
|
||||
import numpy as np
|
||||
|
||||
from bandsaunter.flags import COLOUR_ORDER
|
||||
|
||||
wide = len(COLOUR_ORDER)
|
||||
return bool(((frame >= fm.FLAG) & (frame < fm.FLAG + wide)).any()
|
||||
or ((frame >= fm.FLAG_FADED)
|
||||
& (frame < fm.FLAG_FADED + 3 * wide)).any())
|
||||
|
||||
|
||||
def test_a_crowded_frame_goes_back_to_the_short_label():
|
||||
"""Five lines beside each of three hundred aircraft is not more
|
||||
information, it is a page of overlapping text with a map behind it."""
|
||||
|
|
@ -877,7 +911,7 @@ def test_a_crowded_frame_goes_back_to_the_short_label():
|
|||
known = {t.icao: _Entry() for t in many}
|
||||
frame = fm.render_frame(base, view, many, many[0].first_seen + 60,
|
||||
known=known)
|
||||
assert not (frame >= fm.FLAG).any(), "still drawing flags when crowded"
|
||||
assert not _has_flag(frame), "still drawing flags when crowded"
|
||||
assert not _has_text(frame, "B739")
|
||||
|
||||
|
||||
|
|
@ -949,12 +983,18 @@ def test_the_address_block_stands_in_when_a_register_says_nothing():
|
|||
|
||||
|
||||
def test_a_country_nobody_named_gets_no_flag():
|
||||
track = straight()
|
||||
"""An address outside every block anybody has published, and a register
|
||||
that did not say either: no flag rather than a guessed one."""
|
||||
from bandsaunter.flights import describe_address
|
||||
|
||||
assert describe_address("0F0000") == "", "pick an unallocated address"
|
||||
track = straight(icao="0F0000")
|
||||
entry = _Entry()
|
||||
entry.owner_country = ""
|
||||
entry.country = ""
|
||||
rows = dict(fm.label_lines(track, track.fixes[0], "knots", entry))
|
||||
assert rows["B739 N904DN"] == ""
|
||||
rows = fm.label_lines(track, track.fixes[0], "knots", entry)
|
||||
assert not any(flag for _text, flag in rows if _text == "B739 N904DN")
|
||||
assert dict(rows)["B739 N904DN"] == ""
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
@ -1209,3 +1249,314 @@ def test_a_route_it_could_be_flying_is_drawn():
|
|||
said = [text for text, _flag in
|
||||
fm.label_lines(track, track.fixes[0], "knots", entry)]
|
||||
assert "KLAX" in said and "KDFW" in said
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# What sort of aircraft it is
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_the_label_says_what_sort_of_aircraft_it_is():
|
||||
"""It comes off the air: the three bits under an identification
|
||||
message's type code, which every aircraft sends with its callsign."""
|
||||
track = straight()
|
||||
track.category = "heavy"
|
||||
said = [text for text, _flag in fm.label_lines(track, track.fixes[0],
|
||||
"knots", None)]
|
||||
assert "heavy" in said
|
||||
|
||||
|
||||
def test_a_military_address_says_so_beside_the_aircraft():
|
||||
"""No aircraft broadcasts that it is military -- a tanker calls itself
|
||||
"heavy" exactly as an airliner does -- so it is read off the address."""
|
||||
track = straight(icao="AE07D3") # a United States military block
|
||||
track.category = "heavy"
|
||||
said = [text for text, _flag in fm.label_lines(track, track.fixes[0],
|
||||
"knots", None)]
|
||||
assert "military heavy" in said
|
||||
plain = straight(icao="A12345") # the civil part of the same range
|
||||
plain.category = "heavy"
|
||||
assert "heavy" in [t for t, _f in fm.label_lines(plain, plain.fixes[0],
|
||||
"knots", None)]
|
||||
assert "military heavy" not in [t for t, _f in
|
||||
fm.label_lines(plain, plain.fixes[0],
|
||||
"knots", None)]
|
||||
|
||||
|
||||
def test_an_aircraft_that_says_nothing_about_itself_is_not_given_a_class():
|
||||
track = straight()
|
||||
assert not any(t in ("heavy", "large", "light") for t, _f in
|
||||
fm.label_lines(track, track.fixes[0], "knots", None))
|
||||
|
||||
|
||||
def test_the_class_carries_the_flag_so_the_type_line_need_not():
|
||||
"""One flag per aircraft, on the first row that says what it is."""
|
||||
track = straight()
|
||||
track.category = "large"
|
||||
rows = fm.label_lines(track, track.fixes[0], "knots", _Entry())
|
||||
flags = [(text, flag) for text, flag in rows if flag]
|
||||
assert ("large", "IE") in flags
|
||||
assert dict(rows)["B739 N904DN"] == ""
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# A label that has to move swings there
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_the_label_glide_moves_towards_the_target_and_arrives():
|
||||
here = (0.0, 0.0)
|
||||
for _ in range(40):
|
||||
here = fm._glide(here, (120.0, -80.0), 0.05, fm.LABEL_GLIDE)
|
||||
assert 0.0 <= here[0] <= 120.0 and -80.0 <= here[1] <= 0.0
|
||||
assert here == (120.0, -80.0)
|
||||
|
||||
|
||||
def test_the_label_glide_is_the_same_swing_at_any_frame_rate():
|
||||
fast = slow = (0.0, 0.0)
|
||||
for _ in range(8):
|
||||
fast = fm._glide(fast, (200.0, 0.0), 0.025, fm.LABEL_GLIDE)
|
||||
for _ in range(2):
|
||||
slow = fm._glide(slow, (200.0, 0.0), 0.1, fm.LABEL_GLIDE)
|
||||
assert abs(fast[0] - slow[0]) < 1.0
|
||||
|
||||
|
||||
def test_a_label_keeps_the_place_it_has():
|
||||
"""The reason labels stay still: one is only moved when its own place
|
||||
has actually been taken, never because the placer would now prefer a
|
||||
different one."""
|
||||
places = fm.LabelPlaces()
|
||||
places.settle("ABC123", 100, 100, (160, 90))
|
||||
kept = places.kept("ABC123", 104, 100, lambda bx, by: (int(bx), int(by)))
|
||||
assert kept == (164, 90), "it did not travel with its aircraft"
|
||||
|
||||
|
||||
def test_a_label_whose_place_is_taken_is_sent_looking():
|
||||
places = fm.LabelPlaces()
|
||||
places.settle("ABC123", 100, 100, (160, 90))
|
||||
assert places.kept("ABC123", 100, 100, lambda bx, by: None) is None
|
||||
|
||||
|
||||
def test_a_label_that_has_to_move_swings_rather_than_jumps():
|
||||
places = fm.LabelPlaces()
|
||||
places.settle("ABC123", 0, 0, (100, 100))
|
||||
assert places.drawn("ABC123", 0, 0, (100, 100), 0.08) == (100, 100)
|
||||
part = places.drawn("ABC123", 0, 0, (300, 240), 0.08)
|
||||
assert part != (300, 240), "it jumped the whole way in one frame"
|
||||
assert 100 < part[0] < 300
|
||||
for _ in range(40):
|
||||
part = places.drawn("ABC123", 0, 0, (300, 240), 0.08)
|
||||
assert part == (300, 240)
|
||||
|
||||
|
||||
def test_a_label_is_forgotten_when_its_aircraft_goes():
|
||||
"""Otherwise one that comes back glides in from wherever it stood half
|
||||
an hour ago, across the whole picture."""
|
||||
places = fm.LabelPlaces()
|
||||
places.begin()
|
||||
places.settle("ABC123", 0, 0, (100, 100))
|
||||
places.drawn("ABC123", 0, 0, (100, 100), 0.08)
|
||||
places.end()
|
||||
assert "ABC123" in places.at
|
||||
places.begin()
|
||||
places.end()
|
||||
assert places.at == {} and places.want == {}
|
||||
|
||||
|
||||
def test_a_label_swings_across_a_real_frame_rather_than_jumping():
|
||||
"""The same easing the window does, wired through a drawn frame: the
|
||||
label is somewhere between where it was and where it now belongs, and
|
||||
what is spoken for is where it is going."""
|
||||
track = straight()
|
||||
# A canvas with room around the aircraft, so that a displaced label is
|
||||
# displaced rather than pushed off the edge and refused.
|
||||
view = fm.fit([track], width=800, box=(50.0, -3.0, 52.0, 3.0))
|
||||
base = fm.background(view, unit="knots")
|
||||
places = fm.LabelPlaces()
|
||||
when = track.fixes[0].at
|
||||
fm.render_frame(base, view, [track], when, labels=True, unit="knots",
|
||||
places=places, step=1.0 / 12.0)
|
||||
settled = places.want[track.icao]
|
||||
assert places.at[track.icao] == (float(settled[0]), float(settled[1]))
|
||||
# Push its place a long way, as a crowd of aircraft arriving would.
|
||||
places.want[track.icao] = (settled[0] - 120, settled[1] + 90)
|
||||
after = fm.render_frame(base, view, [track], when, labels=True,
|
||||
unit="knots", places=places, step=1.0 / 12.0)
|
||||
target = places.want[track.icao]
|
||||
now_at = places.at[track.icao]
|
||||
assert target != settled, "the test did not displace it"
|
||||
assert now_at != (float(settled[0]), float(settled[1])), "it did not move"
|
||||
assert now_at != (float(target[0]), float(target[1])), \
|
||||
"it jumped the whole way in one frame"
|
||||
part = (now_at[0] - settled[0]) / (target[0] - settled[0])
|
||||
assert 0.05 < part < 0.60, f"one frame carried it {part:.0%} of the way"
|
||||
# And it gets there, given the frames.
|
||||
for _ in range(30):
|
||||
fm.render_frame(base, view, [track], when, labels=True, unit="knots",
|
||||
places=places, step=1.0 / 12.0)
|
||||
assert places.at[track.icao] == (float(places.want[track.icao][0]),
|
||||
float(places.want[track.icao][1]))
|
||||
assert after.shape == base.shape
|
||||
|
||||
|
||||
def test_a_still_picture_places_its_labels_exactly_as_it_always_did():
|
||||
"""There is no frame before a still, so there is nothing to keep and
|
||||
nothing to swing: the placing has to be untouched."""
|
||||
track = straight()
|
||||
view = fm.fit([track], width=800)
|
||||
base = fm.background(view, unit="knots")
|
||||
when = track.fixes[0].at
|
||||
plain = fm.render_frame(base, view, [track], when, labels=True,
|
||||
unit="knots", project=False)
|
||||
again = fm.render_frame(base, view, [track], when, labels=True,
|
||||
unit="knots", project=False)
|
||||
assert np.array_equal(plain, again)
|
||||
|
||||
|
||||
def test_the_height_does_not_claim_to_know_a_foot_it_was_not_told():
|
||||
"""Most moments in an animation are between two reports and the height
|
||||
at them is interpolated. Mode S reports altitude in twenty-five foot
|
||||
steps, so a real reading survives untouched and an invented one stops
|
||||
pretending to be exact."""
|
||||
track = straight(altitude=37_675)
|
||||
fix = track.fixes[0]
|
||||
assert fm.label_lines(track, fix, "knots", None)[0][0] \
|
||||
.startswith("37,675 ft")
|
||||
from dataclasses import replace
|
||||
|
||||
between = replace(fix, altitude_ft=37_699)
|
||||
assert fm.label_lines(track, between, "knots", None)[0][0] \
|
||||
.startswith("37,700 ft")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# The box fades with the aircraft
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_the_fade_level_follows_the_strength():
|
||||
assert fm.fade_level(1.0) == 0
|
||||
assert fm.fade_level(0.5) == 1
|
||||
assert fm.fade_level(0.3) == 2
|
||||
assert fm.fade_level(0.05) == 3
|
||||
|
||||
|
||||
def test_each_fade_step_of_the_row_grey_is_darker_than_the_last():
|
||||
greys = [fm.PALETTE[fm.LABEL_INK + i].astype(int).sum() for i in range(4)]
|
||||
assert greys == sorted(greys, reverse=True)
|
||||
assert greys[0] > greys[-1] * 3, "the last step is barely dimmer"
|
||||
|
||||
|
||||
def test_each_fade_step_of_a_flag_colour_is_darker_than_the_last():
|
||||
for letter in ("r", "w", "b"):
|
||||
shades = [fm.PALETTE[fm.flag_index(letter, level)].astype(int).sum()
|
||||
for level in range(4)]
|
||||
assert shades == sorted(shades, reverse=True), letter
|
||||
|
||||
|
||||
def test_a_fading_label_is_drawn_fainter_than_a_full_one():
|
||||
"""The name already faded, because it is drawn in the aircraft's own
|
||||
colour. The rows and the flag were fixed colours, so the brightest
|
||||
thing left on that part of the picture was the one aeroplane nothing
|
||||
had been heard from."""
|
||||
track = straight()
|
||||
view = fm.fit([track], width=800, box=(50.0, -3.0, 52.0, 3.0))
|
||||
base = fm.background(view, unit="knots")
|
||||
entry = _Entry()
|
||||
|
||||
def rows_of(strength):
|
||||
img = base.copy()
|
||||
fm._label(img, 300, 200, track, track.fixes[0], fm.RAMP, [], "knots",
|
||||
entry=entry, strength=strength)
|
||||
drawn = img != base
|
||||
return fm.PALETTE[img[drawn]].astype(int).sum()
|
||||
|
||||
full = rows_of(1.0)
|
||||
half = rows_of(0.5)
|
||||
nearly_gone = rows_of(0.05)
|
||||
assert half < full, "a fading label was as bright as a full one"
|
||||
assert nearly_gone < half
|
||||
|
||||
|
||||
def _label_pixels(strength, entry=None):
|
||||
"""One label drawn at a strength, as the palette indices it used."""
|
||||
track = straight()
|
||||
track.category = "large"
|
||||
view = fm.fit([track], width=800, box=(50.0, -3.0, 52.0, 3.0))
|
||||
base = fm.background(view, unit="knots")
|
||||
img = base.copy()
|
||||
fm._label(img, 300, 200, track, track.fixes[0], fm.RAMP, [], "knots",
|
||||
entry=entry if entry is not None else _Entry(),
|
||||
strength=strength)
|
||||
return set(np.unique(img[img != base]).tolist())
|
||||
|
||||
|
||||
def test_the_rows_are_drawn_in_the_grey_for_the_strength_they_are_at():
|
||||
"""Not merely dimmer on average -- the label has a name in it that
|
||||
fades on its own -- but each row written in the grey that belongs to
|
||||
how far the aircraft has faded."""
|
||||
full = _label_pixels(1.0)
|
||||
assert fm.LABEL_INK + 0 in full
|
||||
for strength, level in ((0.5, 1), (0.3, 2), (0.05, 3)):
|
||||
used = _label_pixels(strength)
|
||||
assert fm.LABEL_INK + level in used, strength
|
||||
assert not any(fm.LABEL_INK + other in used
|
||||
for other in range(4) if other != level), strength
|
||||
|
||||
|
||||
def test_the_flag_on_a_label_is_drawn_at_the_labels_own_fade_step():
|
||||
from bandsaunter.flags import COLOUR_ORDER
|
||||
|
||||
wide = len(COLOUR_ORDER)
|
||||
full = _label_pixels(1.0)
|
||||
assert any(fm.FLAG <= i < fm.FLAG + wide for i in full), "no flag drawn"
|
||||
for strength, level in ((0.5, 1), (0.3, 2), (0.05, 3)):
|
||||
used = _label_pixels(strength)
|
||||
assert not any(fm.FLAG <= i < fm.FLAG + wide for i in used), \
|
||||
f"a full-strength flag on a label faded to {strength}"
|
||||
want = fm.FLAG_FADED + (level - 1) * wide
|
||||
assert any(want <= i < want + wide for i in used), strength
|
||||
|
||||
|
||||
def test_a_flag_on_a_fading_label_fades_with_it():
|
||||
from bandsaunter.flags import FLAG_H, FLAG_W
|
||||
|
||||
bright = np.full((40, 60), fm.BG, dtype=np.uint8)
|
||||
faint = np.full((40, 60), fm.BG, dtype=np.uint8)
|
||||
fm.draw_flag(bright, 5, 5, "US", 0)
|
||||
fm.draw_flag(faint, 5, 5, "US", 3)
|
||||
patch = (slice(5, 5 + FLAG_H), slice(5, 5 + FLAG_W))
|
||||
assert fm.PALETTE[faint[patch]].astype(int).sum() < \
|
||||
fm.PALETTE[bright[patch]].astype(int).sum()
|
||||
|
||||
|
||||
def test_a_named_country_with_no_flag_fades_too():
|
||||
faint = np.full((40, 60), fm.BG, dtype=np.uint8)
|
||||
bright = np.full((40, 60), fm.BG, dtype=np.uint8)
|
||||
fm.draw_flag(bright, 5, 5, "ZZ", 0)
|
||||
fm.draw_flag(faint, 5, 5, "ZZ", 3)
|
||||
assert fm.PALETTE[faint].astype(int).sum() < \
|
||||
fm.PALETTE[bright].astype(int).sum()
|
||||
|
||||
|
||||
def test_an_airport_cannot_be_mistaken_for_an_aircraft():
|
||||
"""The old amber sat sixteen units of CIELAB from the ramp's yellow,
|
||||
which is to say it was the same colour: an aeroplane low over a field
|
||||
was drawn in the field's own colour and neither could be picked out.
|
||||
|
||||
Stated as the property rather than as the colour, so that changing the
|
||||
altitude ramp cannot quietly walk an aircraft back into the airports.
|
||||
"""
|
||||
def lab(rgb):
|
||||
c = np.asarray(rgb, float) / 255.0
|
||||
c = np.where(c > 0.04045, ((c + 0.055) / 1.055) ** 2.4, c / 12.92)
|
||||
m = np.array([[0.4124, 0.3576, 0.1805], [0.2126, 0.7152, 0.0722],
|
||||
[0.0193, 0.1192, 0.9505]])
|
||||
xyz = (c @ m.T) / np.array([0.9505, 1.0, 1.089])
|
||||
f = np.where(xyz > 0.008856, np.cbrt(xyz), 7.787 * xyz + 16 / 116)
|
||||
return np.array([116 * f[1] - 16, 500 * (f[0] - f[1]),
|
||||
200 * (f[1] - f[2])])
|
||||
|
||||
airport = lab(fm.PALETTE[fm.AIRPORT])
|
||||
apart = min(float(np.linalg.norm(airport - lab(fm.PALETTE[fm.RAMP + i])))
|
||||
for i in range(fm.RAMP_STEPS))
|
||||
assert apart > 40, (f"the airport colour is {apart:.0f} units from the "
|
||||
f"nearest altitude colour; under about 25 they read "
|
||||
f"as the same colour")
|
||||
|
|
|
|||
|
|
@ -786,3 +786,104 @@ def test_an_airport_nobody_can_place_costs_only_its_own_leg(register,
|
|||
# The middle stop cannot be placed, so neither leg touching it can be
|
||||
# tested; nothing is claimed.
|
||||
assert book.leg_for(entry, 40.8, -78.0) is None
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# What sort of aircraft it is
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_a_military_address_is_read_off_the_block():
|
||||
from bandsaunter.flights import aircraft_class, is_military
|
||||
|
||||
assert is_military("AE07D3") # a United States military block
|
||||
assert not is_military("AC4C44") # the civil part of the same range
|
||||
assert not is_military("") and not is_military("nonsense")
|
||||
assert aircraft_class("AE07D3", "heavy") == "military heavy"
|
||||
assert aircraft_class("AC4C44", "large") == "large"
|
||||
assert aircraft_class("AE07D3") == "military"
|
||||
assert aircraft_class("AC4C44") == ""
|
||||
|
||||
|
||||
def test_military_and_the_country_it_is_described_with_never_disagree():
|
||||
"""Both read the same table, so an address cannot be military and be
|
||||
described as an ordinary country at the same time."""
|
||||
from bandsaunter.flights import (MILITARY_BLOCKS, describe_address,
|
||||
is_military)
|
||||
|
||||
for low, high, name in MILITARY_BLOCKS:
|
||||
for address in (low, (low + high) // 2, high):
|
||||
assert is_military(f"{address:06X}")
|
||||
assert describe_address(f"{address:06X}") == name
|
||||
assert name.endswith(" military")
|
||||
|
||||
|
||||
def test_the_report_says_what_sort_of_aircraft_it_is(tmp_path):
|
||||
"""Off the air, not out of a register: the aeroplane says "heavy" and
|
||||
the address says whose it is."""
|
||||
from bandsaunter.flightlog import report
|
||||
|
||||
log = _log(tmp_path)
|
||||
for i in range(3):
|
||||
log.append(_Frame(icao="AE07D3", callsign="PRIME04"),
|
||||
_Craft(32.7086, -110.4061 + i * 0.01, "PRIME04"),
|
||||
when=1_000_000.0 + i)
|
||||
log.close()
|
||||
tracks = read_logs(log.path)
|
||||
tracks[0].category = "heavy"
|
||||
text = "\n".join(report(tracks, None))
|
||||
assert "class: military heavy" in text
|
||||
|
||||
|
||||
def test_the_report_leaves_the_class_out_when_nothing_said_one(tmp_path):
|
||||
from bandsaunter.flightlog import report
|
||||
|
||||
log = _log(tmp_path)
|
||||
for i in range(3):
|
||||
log.append(_Frame(icao="AC4C44", callsign="SWA2444"),
|
||||
_Craft(32.7086, -110.4061 + i * 0.01, "SWA2444"),
|
||||
when=1_000_000.0 + i)
|
||||
log.close()
|
||||
assert "class:" not in "\n".join(report(read_logs(log.path), None))
|
||||
|
||||
|
||||
def test_the_category_is_read_back_out_of_a_logged_frame(tmp_path):
|
||||
"""The three bits are inside the identification message, which is
|
||||
written down in full, so every log this program has ever written has
|
||||
them -- including the ones written before anything here knew to look."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from bandsaunter.flightlog import read_logs as read
|
||||
|
||||
path = Path(tmp_path) / "old.jsonl"
|
||||
with path.open("w") as out:
|
||||
out.write(json.dumps({"log": "bandsaunter-adsb", "version": 1}) + "\n")
|
||||
# A real identification frame: type code 4, category 3, "large".
|
||||
out.write(json.dumps(
|
||||
{"t": 1.0, "icao": "A80A97", "df": 17, "tc": 4,
|
||||
"hex": "8DA80A97234CB5F5CF4C604EB016",
|
||||
"callsign": "SKW5341"}) + "\n")
|
||||
out.write(json.dumps(
|
||||
{"t": 2.0, "icao": "A80A97", "df": 17, "tc": 11,
|
||||
"hex": "8DA338A6591521A2C718D47E24C0",
|
||||
"lat": 32.2, "lon": -111.0, "alt_ft": 3050}) + "\n")
|
||||
track = read([path])[0]
|
||||
assert track.category == "large"
|
||||
assert track.kind == "large"
|
||||
|
||||
|
||||
def test_a_log_with_nothing_to_read_the_category_from_says_nothing(tmp_path):
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from bandsaunter.flightlog import read_logs as read
|
||||
|
||||
path = Path(tmp_path) / "thin.jsonl"
|
||||
with path.open("w") as out:
|
||||
for line in ({"t": 1.0, "icao": "A80A97", "tc": 4}, # no hex
|
||||
{"t": 2.0, "icao": "A80A97", "tc": 11,
|
||||
"hex": "8DA338A6591521A2C718D47E24C0", # not an ident
|
||||
"lat": 32.2, "lon": -111.0},
|
||||
{"t": 3.0, "icao": "A80A97", "tc": 4, "hex": "8D"}):
|
||||
out.write(json.dumps(line) + "\n")
|
||||
assert read([path])[0].category == ""
|
||||
|
|
|
|||
|
|
@ -1002,3 +1002,357 @@ def test_a_route_it_could_be_flying_stays_in_the_box():
|
|||
assert blip.route_fits is True
|
||||
labels = [label for label, _v, _f in blip.lines("knots")]
|
||||
assert "from" in labels and "to" in labels
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# A box that has to move swings there rather than jumping
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_the_glide_moves_towards_the_target_without_passing_it():
|
||||
from bandsaunter.livemap import glide
|
||||
|
||||
here = (0.0, 0.0)
|
||||
last = here
|
||||
for _ in range(40):
|
||||
here = glide(here, (100.0, -60.0), 0.05)
|
||||
assert 0.0 <= here[0] <= 100.0 and -60.0 <= here[1] <= 0.0
|
||||
assert here[0] >= last[0] and here[1] <= last[1]
|
||||
last = here
|
||||
assert here == (100.0, -60.0), "never actually arrived"
|
||||
|
||||
|
||||
def test_the_glide_arrives_and_stops_asking_for_frames():
|
||||
"""It has to land exactly on the target, not approach it forever: the
|
||||
window repaints faster while anything is moving, and a box that is
|
||||
always a thousandth of a pixel out never lets it stop."""
|
||||
from bandsaunter.livemap import BOX_GLIDE, glide
|
||||
|
||||
here = glide((0.0, 0.0), (50.0, 50.0), BOX_GLIDE * 4)
|
||||
assert here == (50.0, 50.0)
|
||||
assert glide(here, (50.0, 50.0), 0.1) == (50.0, 50.0)
|
||||
|
||||
|
||||
def test_the_glide_is_the_same_swing_at_any_frame_rate():
|
||||
"""Eased by the distance left rather than counted in frames, so a busy
|
||||
machine drawing half as often makes the same movement, not a slower
|
||||
one."""
|
||||
from bandsaunter.livemap import glide
|
||||
|
||||
fast = (0.0, 0.0)
|
||||
for _ in range(8):
|
||||
fast = glide(fast, (200.0, 0.0), 0.025)
|
||||
slow = (0.0, 0.0)
|
||||
for _ in range(2):
|
||||
slow = glide(slow, (200.0, 0.0), 0.1)
|
||||
assert abs(fast[0] - slow[0]) < 1.0
|
||||
|
||||
|
||||
def test_a_frame_that_took_no_time_moves_nothing():
|
||||
from bandsaunter.livemap import glide
|
||||
|
||||
assert glide((3.0, 4.0), (99.0, 99.0), 0.0) == (3.0, 4.0)
|
||||
|
||||
|
||||
def test_a_window_left_buried_does_not_replay_the_moves():
|
||||
"""Ten seconds behind another window is not ten seconds of animation
|
||||
owed; it is a box that should already be where it belongs."""
|
||||
from bandsaunter.livemap import glide
|
||||
|
||||
assert glide((0.0, 0.0), (300.0, 300.0), 10.0) == (300.0, 300.0)
|
||||
|
||||
|
||||
@qt
|
||||
def test_a_box_that_need_not_move_does_not_move(app):
|
||||
"""The whole point of remembering the spot: one aircraft shifting a
|
||||
pixel must not send its neighbour's box across the window."""
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
sky = a_sky(a_blip(icao="A00001", callsign="AAL1", lat=32.60, lon=-111.30),
|
||||
a_blip(icao="A00002", callsign="AAL2", lat=32.20, lon=-110.60))
|
||||
view = SkyView(sky)
|
||||
view.resize(900, 650)
|
||||
_rendered(view)
|
||||
first = dict(view._box_want)
|
||||
assert first, "no box was placed at all"
|
||||
for _ in range(4):
|
||||
_rendered(view)
|
||||
assert dict(view._box_want) == first
|
||||
|
||||
|
||||
@qt
|
||||
def test_a_spot_that_still_works_is_kept(app):
|
||||
"""Hysteresis, and the reason boxes stay still: a box is only moved
|
||||
when its own place is actually taken, never because the placer would
|
||||
now prefer a different one."""
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
view = SkyView(a_sky(a_blip()))
|
||||
view.resize(900, 650)
|
||||
view._box_want["A00001"] = (50, 20)
|
||||
assert view._box_spot("A00001", 400, 300, (120, 60), []) == (450, 320)
|
||||
|
||||
|
||||
@qt
|
||||
def test_a_spot_that_has_been_taken_is_given_up(app):
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
view = SkyView(a_sky(a_blip()))
|
||||
view.resize(900, 650)
|
||||
view._box_want["A00001"] = (50, 20)
|
||||
spot = view._box_spot("A00001", 400, 300, (120, 60),
|
||||
[(450, 320, 120, 60)])
|
||||
assert spot != (450, 320)
|
||||
assert view._box_want["A00001"] == (spot[0] - 400, spot[1] - 300)
|
||||
|
||||
|
||||
@qt
|
||||
def test_the_settled_place_is_what_is_spoken_for(app):
|
||||
"""Laying the next box out against one still in mid-swing would move
|
||||
that one too, and again when the first arrived; the screen would never
|
||||
settle. So the target is what goes into the taken list."""
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
sky = a_sky(a_blip(icao="A00001", callsign="AAL1", lat=32.55, lon=-111.20))
|
||||
view = SkyView(sky)
|
||||
view.resize(900, 650)
|
||||
_rendered(view)
|
||||
was = view._box_at["A00001"]
|
||||
view._box_want["A00001"] = (was[0] + 200, was[1] + 100)
|
||||
view._glide_at = time.time() - 0.05
|
||||
_rendered(view)
|
||||
# Mid-swing, and the spot it is heading for is the one it holds.
|
||||
assert view._box_at["A00001"] != view._box_want["A00001"]
|
||||
assert view._box_spot("A00001", 0, 0, (10, 10), []) == \
|
||||
tuple(view._box_want["A00001"])
|
||||
|
||||
|
||||
@qt
|
||||
def test_the_placer_is_shown_the_settled_spot_not_the_gliding_one(app, monkeypatch):
|
||||
"""The one that decides whether the screen settles. If a box in mid-
|
||||
swing is what the next box is laid out against, that next box moves
|
||||
too -- and moves back when the first one arrives."""
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
early, late = now() - 900, now() - 800
|
||||
sky = a_sky(a_blip(icao="A00001", callsign="AAL1", lat=32.55, lon=-111.20,
|
||||
first_seen=early),
|
||||
a_blip(icao="B00002", callsign="AAL2", lat=32.25, lon=-110.70,
|
||||
first_seen=late))
|
||||
view = SkyView(sky)
|
||||
view.resize(900, 650)
|
||||
_rendered(view)
|
||||
was = view._box_at["A00001"]
|
||||
settled = view._box_want["A00001"]
|
||||
view._box_want["A00001"] = (was[0] + 220, was[1] + 130)
|
||||
# The second one is made to ask for a place, so we can see what it is
|
||||
# shown when it does.
|
||||
view._box_want.pop("B00002")
|
||||
seen = []
|
||||
real = livemap.place_box
|
||||
monkeypatch.setattr(livemap, "place_box",
|
||||
lambda *a: (seen.append(list(a[4])), real(*a))[1])
|
||||
view._glide_at = time.time() - 0.05
|
||||
_rendered(view)
|
||||
assert seen, "the second box never asked for a place"
|
||||
offered = [(r[0], r[1]) for r in seen[-1]]
|
||||
# The offsets are from the symbol, so they only mean anything once the
|
||||
# symbol is where the picture put it.
|
||||
ax, ay = view.projection().xy(32.55, -111.20)
|
||||
target = view._box_want["A00001"]
|
||||
drawn = view._box_at["A00001"]
|
||||
assert drawn != settled and drawn != (float(target[0]), float(target[1])), \
|
||||
"the first box was not in mid-swing, so this proves nothing"
|
||||
going = (ax + target[0], ay + target[1])
|
||||
got_to = (int(round(ax + drawn[0])), int(round(ay + drawn[1])))
|
||||
assert going != got_to, "the two places are the same; nothing is proved"
|
||||
assert going in offered, "the settled spot was not spoken for"
|
||||
assert got_to not in offered, "laid out against a box in mid-swing"
|
||||
|
||||
|
||||
@qt
|
||||
def test_a_box_pushed_off_its_spot_swings_rather_than_jumps(app):
|
||||
"""Drawn between where it was and where it now belongs, for several
|
||||
frames, instead of being in the new place on the very next one."""
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
sky = a_sky(a_blip(icao="A00001", callsign="AAL1", lat=32.55, lon=-111.20))
|
||||
view = SkyView(sky)
|
||||
view.resize(900, 650)
|
||||
_rendered(view)
|
||||
was = view._box_at["A00001"]
|
||||
# Push its settled spot well away, as a crowd of new aircraft would.
|
||||
view._box_want["A00001"] = (was[0] + 240, was[1] + 120)
|
||||
view._glide_at = time.time() - 0.05 # a frame's worth of clock
|
||||
_rendered(view)
|
||||
# Read the target back rather than assuming it: a spot near the edge is
|
||||
# clamped into the window, so the swing may be shorter than it was asked
|
||||
# to be.
|
||||
target = view._box_want["A00001"]
|
||||
moved = view._box_at["A00001"]
|
||||
assert target != was, "the test did not actually displace it"
|
||||
assert moved != was, "it did not move at all"
|
||||
assert moved != target, "it jumped the whole way in one frame"
|
||||
part = (moved[0] - was[0]) / (target[0] - was[0])
|
||||
assert 0.05 < part < 0.60, f"one frame carried it {part:.0%} of the way"
|
||||
assert view._box_moving is True
|
||||
# And it does get there, given the frames.
|
||||
for _ in range(30):
|
||||
view._glide_at = time.time() - 0.05
|
||||
_rendered(view)
|
||||
assert view._box_at["A00001"] == (float(target[0]), float(target[1]))
|
||||
assert view._box_moving is False, "still asking for frames after arriving"
|
||||
|
||||
|
||||
@qt
|
||||
def test_a_box_follows_its_aeroplane_without_that_counting_as_a_move(app):
|
||||
"""The offset is what is remembered, so an aircraft crossing the window
|
||||
carries its box along instead of dragging it there a frame late."""
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
sky = a_sky(a_blip(icao="A00001", callsign="AAL1", lat=32.50, lon=-111.10))
|
||||
view = SkyView(sky)
|
||||
view.resize(900, 650)
|
||||
_rendered(view)
|
||||
settled = view._box_at["A00001"]
|
||||
sky.update([a_blip(icao="A00001", callsign="AAL1",
|
||||
lat=32.70, lon=-110.70)], 1, 1)
|
||||
_rendered(view)
|
||||
assert view._box_at["A00001"] == settled # same offset, new place
|
||||
assert view._box_moving is False
|
||||
|
||||
|
||||
@qt
|
||||
def test_an_aircraft_that_goes_is_forgotten(app):
|
||||
"""Otherwise one that comes back an hour later glides in from wherever
|
||||
it was standing then, across the whole window."""
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
sky = a_sky(a_blip(icao="A00001", callsign="AAL1"))
|
||||
view = SkyView(sky)
|
||||
view.resize(900, 650)
|
||||
_rendered(view)
|
||||
assert "A00001" in view._box_at
|
||||
view.detail = 0 # symbols only: no boxes
|
||||
_rendered(view)
|
||||
assert view._box_at == {} and view._box_want == {}
|
||||
|
||||
|
||||
@qt
|
||||
def test_a_box_in_motion_is_drawn_over_the_ones_standing_still(app):
|
||||
"""It crosses its neighbours for a moment on the way, and the one that
|
||||
is moving is the one being followed, so it is the one that has to stay
|
||||
readable while it does."""
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
sky = a_sky(a_blip(icao="A00001", callsign="AAL1", lat=32.55, lon=-111.20,
|
||||
first_seen=now() - 900),
|
||||
a_blip(icao="B00002", callsign="AAL2", lat=32.25, lon=-110.70,
|
||||
first_seen=now() - 800))
|
||||
view = SkyView(sky)
|
||||
view.resize(900, 650)
|
||||
_rendered(view)
|
||||
order = []
|
||||
real = SkyView._paint_label
|
||||
def watch(self, painter, laid):
|
||||
order.append((laid[0], laid[1].icao))
|
||||
return real(self, painter, laid)
|
||||
SkyView._paint_label = watch
|
||||
try:
|
||||
was = view._box_at["A00001"]
|
||||
# Away from the other one, so that only this box is on the move.
|
||||
view._box_want["A00001"] = (was[0] - 160, was[1] + 150)
|
||||
view._glide_at = time.time() - 0.05
|
||||
_rendered(view)
|
||||
finally:
|
||||
SkyView._paint_label = real
|
||||
assert [icao for moving, icao in order if moving] == ["A00001"], \
|
||||
f"expected only the displaced box to be moving, got {order}"
|
||||
# Everything standing still goes down before anything that is moving.
|
||||
assert order == sorted(order, key=lambda seen: seen[0])
|
||||
assert order[-1][1] == "A00001"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# The ground is dimmed once, not every frame
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _with_ground(width=900, height=650, brightness=0.70):
|
||||
from bandsaunter.livemap import SkyView
|
||||
|
||||
sky = a_sky(a_blip(), brightness=brightness)
|
||||
view = SkyView(sky)
|
||||
view.resize(width, height)
|
||||
projection = view.projection()
|
||||
levels = np.random.default_rng(7).integers(
|
||||
0, 32, (int(height * 1.3), int(width * 1.3)), dtype=np.uint8)
|
||||
sky.set_ground(levels, view.ground_key(projection),
|
||||
view.ground_box(projection))
|
||||
return sky, view
|
||||
|
||||
|
||||
@qt
|
||||
def test_the_dimmed_map_is_kept_between_frames(app):
|
||||
"""Cutting the view out, dimming it and looking every level up in the
|
||||
palette is most of a tenth of a second over two megapixels. Doing it
|
||||
again for a frame in which nothing about it changed put a ceiling of a
|
||||
dozen frames a second on the window."""
|
||||
sky, view = _with_ground()
|
||||
_rendered(view)
|
||||
made = view._ground_pixels
|
||||
assert made is not None
|
||||
_rendered(view)
|
||||
assert view._ground_pixels is made, "the map was dimmed all over again"
|
||||
|
||||
|
||||
@qt
|
||||
def test_a_new_map_is_dimmed_afresh(app):
|
||||
"""Same window, same brightness, same view: only the map itself is
|
||||
different, which is what the count on it is for."""
|
||||
sky, view = _with_ground()
|
||||
_rendered(view)
|
||||
made = view._ground_pixels
|
||||
projection = view.projection()
|
||||
sky.set_ground(np.full_like(sky._ground, 31),
|
||||
view.ground_key(projection), view.ground_box(projection))
|
||||
_rendered(view)
|
||||
assert view._ground_pixels is not made
|
||||
|
||||
|
||||
@qt
|
||||
def test_turning_the_brightness_up_redraws_the_map(app):
|
||||
sky, view = _with_ground()
|
||||
_rendered(view)
|
||||
made = view._ground_pixels.copy()
|
||||
sky.brightness = 0.30
|
||||
_rendered(view)
|
||||
assert not np.array_equal(view._ground_pixels, made)
|
||||
|
||||
|
||||
@qt
|
||||
def test_resizing_the_window_redraws_the_map(app):
|
||||
sky, view = _with_ground()
|
||||
_rendered(view)
|
||||
_rendered(view, width=700, height=500)
|
||||
assert view._ground_pixels.shape[:2] == (500, 700)
|
||||
|
||||
|
||||
def test_the_window_box_says_what_sort_of_aircraft_it_is():
|
||||
"""The same two facts the animation shows, so the two look like the
|
||||
same program: what it broadcast, and whether its address is military."""
|
||||
military = a_blip(icao="AE07D3", callsign="PRIME04")
|
||||
military.category = "heavy"
|
||||
rows = military.lines("knots")
|
||||
assert ("class", "military heavy", "") in rows
|
||||
plain = a_blip(icao="AC4C44", callsign="SWA2444")
|
||||
plain.category = "large"
|
||||
assert ("class", "large", "") in plain.lines("knots")
|
||||
quiet = a_blip(icao="AC4C44", callsign="SWA2444")
|
||||
assert not any(label == "class" for label, _v, _f in quiet.lines("knots"))
|
||||
|
||||
|
||||
def test_the_category_reaches_the_window_from_the_air():
|
||||
from bandsaunter.adsb import Aircraft
|
||||
|
||||
craft = Aircraft(icao="AE07D3", callsign="PRIME04", latitude=32.5,
|
||||
longitude=-111.0, category="heavy")
|
||||
assert blip_for(craft).category == "heavy"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue