def test_valid_values_for_type_in_direct_assignment(): valid_values = ('AUDIO', 'VIDEO', 'SUBTITLES', 'CLOSED-CAPTIONS') media = Media(type='VIDEO', group_id='abc', name='Spanish doubled') for value in valid_values: media.type = value assert media.type == value
def test_invalid_value_for_type_raises_error(): media = Media(group_id='abc', type='AUDIO', name='Spanish doubled') with pytest.raises(InvalidMedia): media.type = 'NONEXISTENT'