def shot_episode(sequence_episode): try: return Shot.find_one(sequence=sequence_episode, name='001') except NoResultFound: return Shot.create(project=sequence_episode.project, sequence=sequence_episode, name='001', cut=(1001, 1002))
def test_create_unique_proj_seq_name(shot): # Expecting IntegrityError error "Duplicate entry..." try: Shot.create(name=shot.name, project=shot.sequence.project, sequence=shot.sequence) except IntegrityError: return raise AssertionError('Expected IntegrityError due to "Duplicate entry"')
def test_cls_name(): assert Shot.cls_name() == 'Shot'
def test_findby_name(shot): assert shot == Shot.find_one(project=shot.project, sequence=shot.sequence, name=shot.name)
def test_find_one(shot): assert shot == Shot.find_one(id=shot.id)
def test_findby_ids(shot): assert shot in Shot.findby_ids([shot.id])
def test_find(shot): assert shot in Shot.find()