Exemplo n.º 1
0
def pedantic(self, parameters, kwds, errordef):
    def w(msg):
        warn(msg, InitialParamWarning, stacklevel=3)
    for vn in parameters:
        if vn not in kwds:
            w('Parameter %s does not have initial value. Assume 0.' % vn)
        if 'error_' + vn not in kwds and 'fix_' + mutil.param_name(vn) not in kwds:
            w('Parameter %s is floating but does not have initial step size. Assume 1.' % vn)
    for vlim in mutil.extract_limit(kwds):
        if mutil.param_name(vlim) not in parameters:
            w('%s is given. But there is no parameter %s. Ignore.' % (vlim, mutil.param_name(vlim)))
    for vfix in mutil.extract_fix(kwds):
        if mutil.param_name(vfix) not in parameters:
            w('%s is given. But there is no parameter %s. Ignore.' % (vfix, mutil.param_name(vfix)))
    for verr in mutil.extract_error(kwds):
        if mutil.param_name(verr) not in parameters:
            w('%s float. But there is no parameter %s. Ignore.' % (verr, mutil.param_name(verr)))
    if errordef is None:
        w('errordef is not given. Default to 1.')
Exemplo n.º 2
0
def test_param_name():
    assert_equal(param_name('N'),'N')
    assert_equal(param_name('limit_N'),'N')
    assert_equal(param_name('error_N'),'N')
    assert_equal(param_name('fix_N'),'N')
Exemplo n.º 3
0
def test_param_name():
    assert param_name('N') == 'N'
    assert param_name('limit_N') == 'N'
    assert param_name('error_N') == 'N'
    assert param_name('fix_N') == 'N'
Exemplo n.º 4
0
def test_param_name():
    with pytest.warns(DeprecationWarning):
        assert util.param_name("N") == "N"
        assert util.param_name("limit_N") == "N"
        assert util.param_name("error_N") == "N"
        assert util.param_name("fix_N") == "N"
Exemplo n.º 5
0
def test_param_name():
    assert param_name('N') == 'N'
    assert param_name('limit_N') == 'N'
    assert param_name('error_N') == 'N'
    assert param_name('fix_N') == 'N'