Skip to content

Commit cc0e210

Browse files
committed
Improve type strictness
1 parent 2f8c542 commit cc0e210

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/europython_discord/registration/ticket.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ class Ticket(BaseModel):
2727
variation: str | None
2828

2929
@computed_field
30+
@property
3031
def key(self) -> str:
3132
return generate_ticket_key(order=self.order, name=self.name)

tests/program_notifications/test_session_to_embed.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def session() -> Session:
3838
website_url="https://example.com/speaker2",
3939
),
4040
],
41-
start="2024-07-10T08:00:00+00:00",
41+
start=datetime.fromisoformat("2024-07-10T08:00:00+00:00"),
4242
title="Example Session",
4343
track=None,
4444
tweet="",
@@ -136,6 +136,8 @@ def test_embed_color(session: Session, level: str, expected_color: int) -> None:
136136
"""Test the color of the embed based on session level."""
137137
session.level = level
138138
embed = session_to_embed.create_session_embed(session, None)
139+
140+
assert embed.color is not None
139141
assert embed.color.value == expected_color
140142

141143

@@ -222,6 +224,8 @@ def test_create_author_from_speakers(session: Session) -> None:
222224
session.speakers[1].avatar = "https://example.com/avatar2.jpg"
223225
author = session_to_embed._create_author_from_speakers(session.speakers)
224226

227+
assert author is not None
228+
225229
# Should combine the names of all speakers
226230
assert author["name"] == "Jane Doe, John Doe"
227231

@@ -238,6 +242,7 @@ def test_create_author_from_speakers_with_no_avatar(session: Session) -> None:
238242
session.speakers[1].avatar = ""
239243

240244
author = session_to_embed._create_author_from_speakers(session.speakers)
245+
assert author is not None
241246
assert author["icon_url"] is None
242247

243248

@@ -250,6 +255,7 @@ def test_create_author_with_long_name(session: Session) -> None:
250255
assert len(session.speakers[0].name) > _AUTHOR_WIDTH
251256

252257
author = session_to_embed._create_author_from_speakers(session.speakers)
258+
assert author is not None
253259
assert author["name"] == (
254260
"This is a very long speaker name which exceeds our maximum author name length, "
255261
"so we expect it to be shortened by our [...]"

tests/registration/test_pretix_connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ async def test_cancelled_orders_are_removed(aiohttp_client, unused_tcp_port_fact
454454

455455
# insert previously paid ticket
456456
ticket = Ticket(order="ABC01", name="Jane Doe", type="Business", variation=None)
457-
pretix_connector.tickets_by_key[ticket.key] = [ticket]
457+
pretix_connector.tickets_by_key[ticket.key] = {ticket}
458458

459459
# fetch pretix data: ticket was cancelled
460460
await pretix_connector.fetch_pretix_data()

0 commit comments

Comments
 (0)