def test_registry(): """All the features should be in the features register.""" assert(CQT.get_id() in msaf.base.features_registry.keys()) assert(PCP.get_id() in msaf.base.features_registry.keys()) assert(Tonnetz.get_id() in msaf.base.features_registry.keys()) assert(MFCC.get_id() in msaf.base.features_registry.keys()) assert(Tempogram.get_id() in msaf.base.features_registry.keys())
def test_change_global_paramaters(): """The features should be correctly updated if global parameters updated.""" feat_type = FeatureTypes.framesync CQT(file_struct, feat_type, sr=11025).features assert (os.path.isfile(file_struct.features_file)) with open(file_struct.features_file) as f: data = json.load(f) assert(CQT.get_id() in data.keys()) # These should have disappeared, since we now have new global parameters assert(MFCC.get_id() not in data.keys()) assert(Tonnetz.get_id() not in data.keys()) assert(Tempogram.get_id() not in data.keys()) assert(PCP.get_id() not in data.keys()) assert("framesync" in data[CQT.get_id()].keys()) assert("est_beatsync" in data[CQT.get_id()].keys()) assert("ann_beatsync" in data[CQT.get_id()].keys())
def test_change_local_cqt_paramaters(): """The features should be correctly updated if parameters of CQT are updated.""" feat_type = FeatureTypes.framesync CQT(file_struct, feat_type, n_bins=70).features assert (os.path.isfile(file_struct.features_file)) with open(file_struct.features_file) as f: data = json.load(f) assert(CQT.get_id() in data.keys()) # These should be here from previous tests assert(MFCC.get_id() in data.keys()) assert(Tonnetz.get_id() in data.keys()) assert(Tempogram.get_id() in data.keys()) assert(PCP.get_id() in data.keys()) assert("framesync" in data[CQT.get_id()].keys()) assert("est_beatsync" in data[CQT.get_id()].keys()) assert("ann_beatsync" in data[CQT.get_id()].keys())