Browse Source

Fix some minor issues with Black and Event.details field

pull/24/head
Jérôme Deuchnord 3 years ago
parent
commit
d08e21c374
3 changed files with 6 additions and 6 deletions
  1. +2
    -2
      kosmorrolib/events.py
  2. +1
    -1
      kosmorrolib/model.py
  3. +3
    -3
      tests/events.py

+ 2
- 2
kosmorrolib/events.py View File

@@ -195,13 +195,13 @@ def _search_maximal_elongations(
) )


for i, time in enumerate(times): for i, time in enumerate(times):
elongation = round(elongations[i],1)
elongation = round(elongations[i], 1)
events.append( events.append(
Event( Event(
EventType.MAXIMAL_ELONGATION, EventType.MAXIMAL_ELONGATION,
[aster], [aster],
translate_to_timezone(time.utc_datetime(), timezone), translate_to_timezone(time.utc_datetime(), timezone),
details={"deg": f"{elongation}°"},
details={"deg": elongation},
) )
) )




+ 1
- 1
kosmorrolib/model.py View File

@@ -154,7 +154,7 @@ class Event(Serializable):
objects: [Object], objects: [Object],
start_time: datetime, start_time: datetime,
end_time: Union[datetime, None] = None, end_time: Union[datetime, None] = None,
details: dict = None,
details: {str: any} = None,
): ):
self.event_type = event_type self.event_type = event_type
self.objects = objects self.objects = objects


+ 3
- 3
tests/events.py View File

@@ -74,7 +74,7 @@ EXPECTED_EVENTS = [
EventType.MAXIMAL_ELONGATION, EventType.MAXIMAL_ELONGATION,
[ASTERS[2]], [ASTERS[2]],
datetime(2020, 2, 10, 13, 46), datetime(2020, 2, 10, 13, 46),
details={'deg':"18.2°"},
details={"deg": 18.2},
), ),
Event(EventType.MOON_PERIGEE, [ASTERS[1]], datetime(2020, 2, 10, 20, 34)), Event(EventType.MOON_PERIGEE, [ASTERS[1]], datetime(2020, 2, 10, 20, 34)),
], ],
@@ -86,14 +86,14 @@ EXPECTED_EVENTS = [
EventType.MAXIMAL_ELONGATION, EventType.MAXIMAL_ELONGATION,
[ASTERS[2]], [ASTERS[2]],
datetime(2020, 3, 24, 1, 56), datetime(2020, 3, 24, 1, 56),
details={'deg':"27.8°"},
details={"deg": 27.8},
), ),
Event(EventType.MOON_APOGEE, [ASTERS[1]], datetime(2020, 3, 24, 15, 39)), Event(EventType.MOON_APOGEE, [ASTERS[1]], datetime(2020, 3, 24, 15, 39)),
Event( Event(
EventType.MAXIMAL_ELONGATION, EventType.MAXIMAL_ELONGATION,
[ASTERS[3]], [ASTERS[3]],
datetime(2020, 3, 24, 21, 58), datetime(2020, 3, 24, 21, 58),
details={'deg':"46.1°"},
details={"deg": 46.1},
), ),
], ],
), ),


Loading…
Cancel
Save