예제 #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()
예제 #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)
예제 #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
예제 #4
0
def test_Observation___init__(raw_obs):
    obs = model.Observation(**raw_obs)
    assert obs
예제 #5
0
def test_Observation___get_item__(rwc_obs):
    obs = model.Observation(**rwc_obs)
    assert obs['index'] == obs.index == rwc_obs['index']
예제 #6
0
def test_Observation_to_dict(rwc_obs):
    obs = model.Observation(**rwc_obs)
    rec_obs = obs.to_dict()
    assert rec_obs == rwc_obs
예제 #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']
예제 #8
0
def test_Observation_to_builtin(rwc_obs):
    obs = model.Observation(**rwc_obs)
    assert obs.to_builtin() == rwc_obs