Add test for scrape_url for both games

This commit is contained in:
chris committed 2026-02-22 19:11:10 -05:00
1 parent 8dd8c1a241
commit 2013d48186
1 file changed
+12
+12
View File
@@ -1,7 +1,13 @@
"""Tests for the `util` module.""" """Tests for the `util` module."""
from dotenv import load_dotenv
import os
import pytest import pytest
import util.convert as uc import util.convert as uc
import util.drawing as ud import util.drawing as ud
import util.scrape as sc
load_dotenv()
def test_convert_string_to_integer() -> None: def test_convert_string_to_integer() -> None:
@@ -39,3 +45,9 @@ def test_get_next_draw_date_specified_from_date() -> None:
assert ud.get_next_draw_date(game='powerball', from_date='02/19/2026') == '02/21/2026' assert ud.get_next_draw_date(game='powerball', from_date='02/19/2026') == '02/21/2026'
assert ud.get_next_draw_date(game='powerball', from_date='02/20/2026') == '02/21/2026' assert ud.get_next_draw_date(game='powerball', from_date='02/20/2026') == '02/21/2026'
@pytest.mark.parametrize("game", ['powerball', 'mega-millions'])
def test_scrape_url(game) -> None:
"""Test scraping the powerball result page for 1996."""
scrape_data = sc.scrape_url(game, year=1996)
assert len(scrape_data) in [17, 104]