Beispiel #1
0
def test_register():
    class Custom(filterbanks.Filterbank):
        def filters(self):
            return None

    filterbanks.register_filterbank(Custom)
    cls = filterbanks.get("Custom")
    assert cls == Custom

    with pytest.raises(ValueError):
        filterbanks.register_filterbank(filterbanks.STFTFB)
Beispiel #2
0
def test_get_none():
    assert filterbanks.get(None) is None
Beispiel #3
0
def test_get_errors(wrong):
    with pytest.raises(ValueError):
        # Should raise for anything not a Optimizer instance + unknown string
        filterbanks.get(wrong)
Beispiel #4
0
def test_make_enc_dec(who):
    fb_config = {"n_filters": 500, "kernel_size": 16, "stride": 8}
    enc, dec = make_enc_dec("free", who_is_pinv=who, **fb_config)
    enc, dec = make_enc_dec(FreeFB, who_is_pinv=who, **fb_config)
    assert enc.filterbank == filterbanks.get(enc.filterbank)