Reformat code to pythonic standards
This commit is contained in:
1 parent
e2b8f5497c
commit
ea62bdfc0b
6 files changed
+249
-100
No files matched your search
@@ -1,10 +1,10 @@
|
||||
from datetime import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from httpx import ConnectError
|
||||
|
||||
from conftest import PowerballDraw
|
||||
from httpx import ConnectError
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
|
||||
from util.drawing import get_powerball_object
|
||||
from util.scrape import scrape_game_history
|
||||
|
||||
@@ -12,8 +12,11 @@ from util.scrape import scrape_game_history
|
||||
def test_create_powerball_draw(db_session) -> None:
|
||||
"""add a record"""
|
||||
date = datetime(2010, 2, 3).date()
|
||||
new_record = PowerballDraw(draw_date=date, main_ball1=17, main_ball2=22, main_ball3=36, main_ball4=37,
|
||||
main_ball5=52, powerball=24, power_play=2)
|
||||
new_record = PowerballDraw(
|
||||
draw_date=date, main_ball1=17, main_ball2=22, main_ball3=36,
|
||||
main_ball4=37,
|
||||
main_ball5=52, powerball=24, power_play=2,
|
||||
)
|
||||
db_session.add(new_record)
|
||||
db_session.commit()
|
||||
|
||||
@@ -31,15 +34,20 @@ def test_powerball_draw_isolation(db_session) -> None:
|
||||
|
||||
def test_powerball_draw_by_date_blank(db_session) -> None:
|
||||
"""query for all powerball records with a blank date"""
|
||||
blank_results = db_session.query(PowerballDraw).filter_by(draw_date='').all()
|
||||
blank_results = db_session.query(PowerballDraw).filter_by(
|
||||
draw_date='',
|
||||
).all()
|
||||
assert len(blank_results) == 0
|
||||
|
||||
|
||||
def test_powerball_draw_integrity(db_session) -> None:
|
||||
"""ensure that duplicate records cannot be inserted"""
|
||||
date = datetime(2010, 2, 3).date()
|
||||
new_record = PowerballDraw(draw_date=date, main_ball1=17, main_ball2=22, main_ball3=36, main_ball4=37,
|
||||
main_ball5=52, powerball=24, power_play=2)
|
||||
new_record = PowerballDraw(
|
||||
draw_date=date, main_ball1=17, main_ball2=22, main_ball3=36,
|
||||
main_ball4=37,
|
||||
main_ball5=52, powerball=24, power_play=2,
|
||||
)
|
||||
|
||||
try:
|
||||
# insert a new record
|
||||
@@ -56,8 +64,11 @@ def test_powerball_draw_integrity(db_session) -> None:
|
||||
def test_powerball_draw_eq_repr_and_str(db_session) -> None:
|
||||
"""test the __eq__, __repr__ and __str__ methods of PowerballDraw"""
|
||||
date = datetime(2010, 2, 3).date()
|
||||
new_record = PowerballDraw(draw_date=date, main_ball1=17, main_ball2=22, main_ball3=36, main_ball4=37,
|
||||
main_ball5=52, powerball=24, power_play=2)
|
||||
new_record = PowerballDraw(
|
||||
draw_date=date, main_ball1=17, main_ball2=22, main_ball3=36,
|
||||
main_ball4=37,
|
||||
main_ball5=52, powerball=24, power_play=2,
|
||||
)
|
||||
|
||||
# insert a new record
|
||||
db_session.add(new_record)
|
||||
|
||||
Reference in new issue
Block a user