Skip to content

Instantly share code, notes, and snippets.

@colonelpanic8
Created August 3, 2024 04:24
Show Gist options
  • Save colonelpanic8/ce3ef8c2ce791110f88612dd74bf3e9f to your computer and use it in GitHub Desktop.
Save colonelpanic8/ce3ef8c2ce791110f88612dd74bf3e9f to your computer and use it in GitHub Desktop.
@pytest.mark.writes_db
@pytest.mark.runs_model
def test_jaws_combos(
video_container_factory,
get_feature_extractions,
video_factory,
sync_sessionmaker,
user_factory,
):
container = video_container_factory("4.mov")
db_writer = container.pool_session_writer(
video_factory.default, user_id=user_factory.default.id
)
feature_extractions: List[shot_parsing.FeatureExtraction] = get_feature_extractions(
video_container=container
)
for feature_extraction in feature_extractions:
assert feature_extraction.make
assert feature_extraction.object_ball != feature_extraction.target_ball
container.wait_for_queues_to_empty(db_writer.feature_listener.queue)
assert len(feature_extractions) == 3
with sync_sessionmaker() as session:
with session.begin():
result = session.execute(sa.select(models.ShotModel))
shots = result.unique().scalars().all()
assert len(shots) == 3
for shot in shots:
assert shot.cue_object_features.cue_object_angle
assert shot.cue_object_features.cue_ball_speed2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment