示例#1
0
def test_contains():

    P = presets.Preset(preset_test)
    P['b'] = 3

    assert 'b' in P
    assert 'c' not in P
示例#2
0
def test_set_get():

    b = 20
    P = presets.Preset(preset_test)
    P['b'] = b

    assert P['b'] == b
示例#3
0
def test_revert():
    b = -3

    P = presets.Preset(preset_test)
    P['b'] = b
    del P['b']
    assert preset_test.mult(4) == P.mult(4)
示例#4
0
def test_main_update():
    b = -3
    P = presets.Preset(preset_test)
    P['b'] = b
    assert preset_test.mult(4, b=b) == P.mult(4)
    P['b'] = b + 10
    assert preset_test.mult(4, b=b+10) == P.mult(4)
示例#5
0
def test_keys():

    P = presets.Preset(preset_test)

    params = dict(b=30, c=20, d=50)
    P.update(params)

    assert set(P.keys()) == set(params.keys())
示例#6
0
def test_update():

    P = presets.Preset(preset_test)

    params = dict(b=30, c=20, d=50)
    P.update(params)

    for key in params.keys():
        assert P[key] == params[key]
示例#7
0
def test_external():
    P = presets.Preset(preset_test)

    assert preset_test.pickle == P.pickle
示例#8
0
def test_main_default():

    P = presets.Preset(preset_test)
    assert preset_test.mult(4) == P.mult(4)
示例#9
0
def test_user_override():
    b = -3

    P = presets.Preset(preset_test)
    P['b'] = b
    assert preset_test.mult(4, b=10 + b) == P.mult(4, b=10 + b)
示例#10
0
def test_submod_override():
    b = -3

    P = presets.Preset(preset_test)
    P['b'] = b
    assert preset_test.submod.add(4, b=b) == P.submod.add(4)
示例#11
0
def test_main_override():
    b = -3

    P = presets.Preset(preset_test)
    P['b'] = b
    assert preset_test.mult(4, b=b) == P.mult(4)
示例#12
0
def test_submod_default():
    P = presets.Preset(preset_test)

    assert preset_test.submod.add(4) == P.submod.add(4)
示例#13
0
def test_docstring():

    P = presets.Preset(preset_test)
    assert 'WARNING' in P.mult.__doc__
示例#14
0
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''Wrap librosa for default DSP settings'''

import librosa as _librosa
import presets

# Global DSP parameters via presets

librosa = presets.Preset(_librosa)
librosa['sr'] = 32768
librosa['hop_length'] = 256