Skip to content

Commit

Permalink
Merge pull request #102 from elliot-100/minor
Browse files Browse the repository at this point in the history
Minor code improvements and doc fixes
  • Loading branch information
elliot-100 authored May 9, 2024
2 parents e283c08 + 6577404 commit 75a244a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions spond_classes/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ class Event(BaseModel):
heading : str
Heading/name of the Event.
`heading` in API.
responses : Responses
start_time : datetime.
Datetime at which the Event starts.
`startTimestamp` in API, but returns a datetime instead of a string.
responses : Responses
"""

uid: str = Field(alias="id")
heading: str
start_time: datetime = Field(alias="startTimestamp")
responses: Responses
start_time: datetime = Field(alias="startTimestamp")

def __str__(self) -> str:
"""Return simple human-readable description.
Expand Down
4 changes: 1 addition & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def member_with_profile_data() -> dict:
def simple_group_data() -> dict:
"""Represent the simplest possible Group in this implementation.
For testing Event in isolation.
Item from 'groups' (root).
"""
return {
Expand Down Expand Up @@ -157,7 +156,6 @@ def complex_group_data() -> dict:
def simple_event_data() -> dict:
"""Represent the simplest possible Event in this implementation.
For testing Event in isolation.
Item from 'events' (root).
"""
return {
Expand All @@ -184,7 +182,6 @@ def complex_event_data() -> dict:
return {
"id": "36D7F1A46EB2CDED4B6F22D400229822",
"heading": "Event 2",
"startTimestamp": "2022-11-04T06:00:00Z",
"responses": {
"acceptedIds": [
"B24FA75A4CCBC63199A57361E88B0646",
Expand All @@ -207,4 +204,5 @@ def complex_event_data() -> dict:
"49C2447E4ADE8005A9652B24F95E4F6F",
],
},
"startTimestamp": "2022-11-04T06:00:00Z",
}
6 changes: 3 additions & 3 deletions tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from datetime import datetime, timezone

from spond_classes import Event
from spond_classes.event import Event


def test_from_dict_simple(simple_event_data: dict) -> None:
Expand All @@ -14,12 +14,12 @@ def test_from_dict_simple(simple_event_data: dict) -> None:

assert my_event.uid == "A390CE5396D2F5C3015F53E171EC59D5"
assert my_event.heading == "Event 1"
assert my_event.start_time == datetime(2021, 7, 6, 6, 0, tzinfo=timezone.utc)
assert my_event.responses.accepted_uids == []
assert my_event.responses.declined_uids == []
assert my_event.responses.unanswered_uids == []
assert my_event.responses.waiting_list_uids == []
assert my_event.responses.unconfirmed_uids == []
assert my_event.start_time == datetime(2021, 7, 6, 6, 0, tzinfo=timezone.utc)
assert str(my_event) == "Event 'Event 1' on 2021-07-06"


Expand All @@ -32,7 +32,6 @@ def test_from_dict_complex(complex_event_data: dict) -> None:

assert my_event.uid == "36D7F1A46EB2CDED4B6F22D400229822"
assert my_event.heading == "Event 2"
assert my_event.start_time == datetime(2022, 11, 4, 6, 0, tzinfo=timezone.utc)
assert my_event.responses.accepted_uids == [
"B24FA75A4CCBC63199A57361E88B0646",
"C7BCC3B8A95DCF82DFFD27B2B30C8FA2",
Expand All @@ -53,4 +52,5 @@ def test_from_dict_complex(complex_event_data: dict) -> None:
"2D1BB37608F09511FD5F280D219DFD97",
"49C2447E4ADE8005A9652B24F95E4F6F",
]
assert my_event.start_time == datetime(2022, 11, 4, 6, 0, tzinfo=timezone.utc)
assert str(my_event) == "Event 'Event 2' on 2022-11-04"
2 changes: 1 addition & 1 deletion tests/test_group.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for Group class."""

from spond_classes import Group
from spond_classes.group import Group


def test_from_dict_simple(simple_group_data: dict) -> None:
Expand Down

0 comments on commit 75a244a

Please sign in to comment.