Beispiel #1
0
def test_Observation_validate(raw_obs):
    obs = model.Observation(**raw_obs)
    assert obs.SCHEMA

    assert obs.validate()
    raw_obs['audio_file'] = "dummy_philharmonia/www.philharmonia.co.uk/"\
                            "assets/audio/samples/instruments/cello.zip"
    obs = model.Observation(**raw_obs)
    assert not obs.validate()
Beispiel #2
0
def test_Observation_validate(rwc_root, rwc_obs, test_obs):
    obs = model.Observation(**rwc_obs)
    assert obs.SCHEMA
    assert not obs.validate()
    assert obs.validate(check_files=False)

    rwc_obs['audio_file'] = os.path.join(rwc_root, rwc_obs['audio_file'])
    obs = model.Observation(**rwc_obs)
    assert obs.validate()

    rwc_obs['audio_file'] = ("dummy_philharmonia/www.philharmonia.co.uk/"
                             "assets/audio/samples/instruments/cello.zip")
    obs = model.Observation(**rwc_obs)
    assert not obs.validate()

    for o in test_obs:
        assert model.Observation(**o).validate(verbose=True, check_files=False)
Beispiel #3
0
def test_Collection___init__(test_obs, rwc_obs, rwc_root):
    dset = model.Collection(test_obs)
    assert dset is not None

    with pytest.raises(model.MissingDataException):
        dset = model.Collection(test_obs, strict=True)

    obs = model.Observation(**rwc_obs)
    with pytest.raises(model.MissingDataException):
        dset = model.Collection([obs], audio_root='', strict=True)

    dset = model.Collection([obs], audio_root=rwc_root, strict=True)
    assert dset is not None
Beispiel #4
0
def test_Observation___init__(raw_obs):
    obs = model.Observation(**raw_obs)
    assert obs
Beispiel #5
0
def test_Observation___get_item__(rwc_obs):
    obs = model.Observation(**rwc_obs)
    assert obs['index'] == obs.index == rwc_obs['index']
Beispiel #6
0
def test_Observation_to_dict(rwc_obs):
    obs = model.Observation(**rwc_obs)
    rec_obs = obs.to_dict()
    assert rec_obs == rwc_obs
Beispiel #7
0
def test_Observation_to_series(rwc_obs):
    obs = model.Observation(**rwc_obs)
    rec = obs.to_series()
    assert rec.name == rwc_obs['index']
    assert rec.instrument == rwc_obs['instrument']
Beispiel #8
0
def test_Observation_to_builtin(rwc_obs):
    obs = model.Observation(**rwc_obs)
    assert obs.to_builtin() == rwc_obs