def test_job_from_dict(data, expected):
    "Jobs are deserialized from dicts correctly."
    job = Job.from_dict(Config.default(), data)
    assert job == expected
def test_job_from_dict_invalid(data):
    "Deserializing an invalid job dict results in an error."
    with pytest.raises(Error):
        Job.from_dict(Config.default(), data)
    "Deserializing an invalid clip dict results in an error."
    with pytest.raises(Error):
        Clip.from_dict(data)


# pylint: disable=too-many-arguments
@pytest.mark.parametrize(
    "clip,config,date,epoch,title,expected",
    [
        # Clip start time is relative to video time with epoch 0
        (
            Clip.from_dict({
                "time": "1-2",
                "title": "title"
            }),
            Config.default(),
            datetime.datetime(1970, 1, 1),
            datetime.timedelta(),
            "test",
            "1970-01-01 00-00-00 - t+0h00m01s - test - title.mkv",
        ),
        # Clip start time and video time are adjusted with positive epoch
        (
            Clip.from_dict({
                "time": "1-2",
                "title": "title"
            }),
            Config.default(),
            datetime.datetime(1970, 1, 1),
            datetime.timedelta(seconds=1),
            "test",