You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import unittest
|
|
|
|
import requests
|
|
|
|
|
|
|
|
from lottery_data_scraper import louisiana
|
|
|
|
from lottery_data_scraper import schemas
|
|
|
|
|
|
|
|
class TestLouisiana(unittest.TestCase):
|
|
|
|
def test_parse_game_html(self):
|
|
|
|
# URL chosen arbitrarily
|
|
|
|
url = 'https://louisianalottery.com/scratch-offs/1450/blazing-suits'
|
|
|
|
html = louisiana.fetch_html(url)
|
|
|
|
game = louisiana.parse_game(url, html)
|
|
|
|
self.assertEqual(game['name'], 'Blazing Suits')
|
|
|
|
self.assertEqual(game["price"], 10.0)
|
|
|
|
self.assertEqual(
|
|
|
|
game["url"],
|
|
|
|
'https://louisianalottery.com/scratch-offs/1450/blazing-suits' ,
|
|
|
|
)
|
|
|
|
self.assertEqual(game["game_id"], "1450")
|
|
|
|
self.assertEqual(game["prizes"][0]["prize"], "$200,000")
|
|
|
|
self.assertEqual(game["prizes"][0]["value"], 200000.0)
|
|
|
|
|