Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xoolive committed Oct 31, 2024
1 parent d09a3ff commit 226b530
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
13 changes: 6 additions & 7 deletions src/traffic/core/lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ def lazy_λf(
lazy_λf.__annotations__ = dict( # make a copy!!
getattr(Flight, f.__name__).__annotations__
)
lazy_λf.__annotations__["self"] = LazyTraffic
lazy_λf.__annotations__["return"] = LazyTraffic

# Attach the method to LazyCollection for further chaining
Expand Down Expand Up @@ -466,14 +465,14 @@ def λf(
GeographyMixin, predicate=inspect.isfunction
):
annots = handle.__annotations__
if name.startswith("_") or "self" not in annots or "return" not in annots:
if name.startswith("_") or "return" not in annots:
continue

if ( # includes .query()
annots["return"] == annots["self"]
or annots["return"] == Optional[annots["self"]] # noqa: F821
or annots["return"] == f"Optional[{annots['self']}]"
or annots["return"] == f"None | {annots['self']}"
# includes .query(), etc.
if (
annots["return"] == "Self"
or annots["return"] == "Optional[Self]"
or annots["return"] == "None | Self"
):

def make_lambda(name: str) -> Callable[..., LazyTraffic]:
Expand Down
4 changes: 1 addition & 3 deletions src/traffic/plugins/cesiumjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from ..core import Flight, Traffic
from ..core.time import timelike, to_datetime
from ..data import SO6

_log = logging.getLogger(__name__)

Expand Down Expand Up @@ -92,7 +91,7 @@ def export_flight(flight: Flight) -> Iterator[Dict[str, Any]]:


def to_czml(
traffic: Union[None, Traffic, SO6],
traffic: Union[None, Traffic],
filename: Union[str, Path],
minimum_time: Optional[timelike] = None,
) -> None:
Expand Down Expand Up @@ -142,4 +141,3 @@ def to_czml(

def _onload() -> None:
setattr(Traffic, "to_czml", to_czml)
setattr(SO6, "to_czml", to_czml)
2 changes: 0 additions & 2 deletions tests/test_traffic.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ def test_index() -> None:
assert s_0 is not None
assert s_0.callsign == "SAA260"

assert switzerland[2000] is None

subset = switzerland[:2]
assert subset is not None
assert subset.callsigns == {"SAA260", "SAA261"}
Expand Down

0 comments on commit 226b530

Please sign in to comment.