예제 #1
0
def test_params(weights):
    p = {'weights': weights, 'dither': 0.1}
    assert BottleneckProcessor(**p).get_params() == p

    b = BottleneckProcessor()
    assert b.weights == 'BabelMulti'
    b.set_params(**p)
    assert BottleneckProcessor(**p).get_params() == p
    assert b.weights == weights
예제 #2
0
def test_bad_params():
    w = 'BadWeights'
    with pytest.raises(ValueError) as err:
        BottleneckProcessor(w)
    assert 'invalid weights' in str(err.value)

    b = BottleneckProcessor()
    with pytest.raises(ValueError) as err:
        b.set_params(**{'weights': w})
    assert 'invalid weights' in str(err.value)