

def generic_check(self, expr, desired, **kw):
    ast_list = parser.expr(expr).tolist()
    args = harvest_variables(ast_list)
    loc = locals().update(kw)
    for var in args:
        s = ('%s = size_check.dummy_array(%s)' % (var, var))
        exec(s, loc)
    try:
        actual = eval(expr, locals()).shape
    except:
        actual = 'failed'
    if ((actual is 'failed') and (desired is 'failed')):
        return
    assert_array_equal(actual, desired, expr)

dataset/ETHPy150Open scipy/scipy/scipy/weave/tests/test_size_check.py TestExpressions.generic_check/original