Run Black formatter across 83 files and fix 1514 ruff violations: - E722: bare except → typed exceptions (17 fixes) - E711/E712/E721: comparison style fixes with noqa for SQLAlchemy (44 fixes) - F841: unused variable assignments (70 fixes) - F541/F401: f-string and import cleanup (1383 auto-fixes) Remaining 925 errors are all F403/F405 (star imports) — structural, requires converting to explicit imports in a separate effort. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
61 lines
1.6 KiB
Python
61 lines
1.6 KiB
Python
from sqlmodel import Session
|
|
|
|
from in_game.gameplay_models import select, Cardset, GameCardsetLink
|
|
|
|
|
|
def test_create_cardset(session: Session):
|
|
cardset_1 = session.get(Cardset, 1)
|
|
cardset_2 = session.get(Cardset, 2)
|
|
|
|
assert cardset_1.name == "1969 Live"
|
|
assert cardset_2.name == "2024 Season"
|
|
|
|
|
|
def test_delete_cardset(session: Session):
|
|
cardset_1 = session.get(Cardset, 1)
|
|
session.delete(cardset_1)
|
|
|
|
bad_links = session.exec(
|
|
select(GameCardsetLink).where(GameCardsetLink.cardset_id == 1)
|
|
).all()
|
|
assert len(bad_links) == 0
|
|
|
|
|
|
def test_create_cardsetgamelink(session: Session):
|
|
pri_1 = session.exec(
|
|
select(GameCardsetLink).where(GameCardsetLink.priority == 1)
|
|
).all()
|
|
assert len(pri_1) == 3
|
|
|
|
pri_2 = session.exec(
|
|
select(GameCardsetLink).where(GameCardsetLink.priority == 2)
|
|
).all()
|
|
assert len(pri_2) == 1
|
|
|
|
g_1 = session.exec(
|
|
select(GameCardsetLink).where(GameCardsetLink.game_id == 1)
|
|
).all()
|
|
assert len(g_1) == 2
|
|
|
|
g_2 = session.exec(
|
|
select(GameCardsetLink).where(GameCardsetLink.game_id == 2)
|
|
).all()
|
|
assert len(g_2) == 2
|
|
|
|
|
|
def test_update_cardsetgamelink(session: Session):
|
|
pri_1 = session.exec(
|
|
select(GameCardsetLink).where(GameCardsetLink.priority == 1)
|
|
).all()
|
|
assert len(pri_1) == 3
|
|
|
|
link_2 = session.get(GameCardsetLink, (1, 1))
|
|
link_2.priority = 2
|
|
session.add(link_2)
|
|
session.commit()
|
|
|
|
pri_1 = session.exec(
|
|
select(GameCardsetLink).where(GameCardsetLink.priority == 1)
|
|
).all()
|
|
assert len(pri_1) == 2
|