test.py 261 字节
Newer Older
6
6453330b12700e0fdb30f0d0 已提交
1 2 3 4 5 6 7 8 9 10 11

def test_closure_func():
    # 调用外部函数
    closure_func = outer_func(5)

    # 调用闭包函数,将结果与期望值比较
    assert closure_func(10) == 15
    assert closure_func(20) == 25
    assert closure_func(-5) == 0

test_closure_func()