refactor: rename functions across codebase for clarity
All checks were successful
CI / Lint (push) Successful in 7s
CI / Test (push) Successful in 5s
CI / Build & Push (push) Successful in 14s

This commit is contained in:
2026-03-29 10:21:01 -04:00
parent a4dc7dff52
commit dd5ac945bd
7 changed files with 70 additions and 69 deletions

View File

@@ -1,12 +1,12 @@
from tests.conftest import make_game
from app.games import (
convert_game_state,
format_record,
get_game_outcome,
process_period,
process_record,
process_start_time,
process_time_remaining,
utc_to_est_time,
get_period,
get_start_time,
get_time_remaining,
utc_to_eastern,
)
@@ -26,65 +26,65 @@ class TestConvertGameState:
class TestProcessRecord:
def test_na_returns_na(self):
assert process_record("N/A") == "N/A"
assert format_record("N/A") == "N/A"
def test_pads_single_digit_parts(self):
assert process_record("5-3-1") == "05-03-01"
assert format_record("5-3-1") == "05-03-01"
def test_already_padded_unchanged(self):
assert process_record("40-25-10") == "40-25-10"
assert format_record("40-25-10") == "40-25-10"
class TestProcessPeriod:
def test_pre_game_returns_zero(self):
game = make_game(game_state="PRE")
assert process_period(game) == 0
assert get_period(game) == 0
def test_fut_game_returns_zero(self):
game = make_game(game_state="FUT")
assert process_period(game) == 0
assert get_period(game) == 0
def test_final_game_returns_na(self):
game = make_game(game_state="OFF")
assert process_period(game) == "N/A"
assert get_period(game) == "N/A"
def test_live_game_returns_period_number(self):
game = make_game(game_state="LIVE", period=2)
assert process_period(game) == 2
assert get_period(game) == 2
class TestProcessTimeRemaining:
def test_pre_game_returns_2000(self):
game = make_game(game_state="FUT")
assert process_time_remaining(game) == "20:00"
assert get_time_remaining(game) == "20:00"
def test_final_game_returns_0000(self):
game = make_game(game_state="OFF")
assert process_time_remaining(game) == "00:00"
assert get_time_remaining(game) == "00:00"
def test_live_game_returns_clock(self):
game = make_game(game_state="LIVE", seconds_remaining=305)
assert process_time_remaining(game) == "05:05"
assert get_time_remaining(game) == "05:05"
def test_live_game_at_zero_returns_end(self):
game = make_game(game_state="LIVE", seconds_remaining=0)
assert process_time_remaining(game) == "END"
assert get_time_remaining(game) == "END"
class TestProcessStartTime:
def test_pre_game_returns_est_time(self):
game = make_game(game_state="FUT", start_time_utc="2024-04-10T23:00:00Z")
result = process_start_time(game)
result = get_start_time(game)
assert result == "7:00 PM"
def test_pre_game_strips_leading_zero(self):
game = make_game(game_state="FUT", start_time_utc="2024-04-10T22:00:00Z")
result = process_start_time(game)
result = get_start_time(game)
assert not result.startswith("0")
def test_live_game_returns_na(self):
game = make_game(game_state="LIVE")
assert process_start_time(game) == "N/A"
assert get_start_time(game) == "N/A"
class TestGetGameOutcome:
@@ -99,5 +99,5 @@ class TestGetGameOutcome:
class TestUtcToEstTime:
def test_converts_utc_to_est(self):
result = utc_to_est_time("2024-04-10T23:00:00Z")
result = utc_to_eastern("2024-04-10T23:00:00Z")
assert result == "07:00 PM"