示例工程 07-names-scope-imports

07-names-scope-imports/05-legb-and-global/test_legb_and_global.py

python · 0.3 KB

"""test_legb_and_global.py"""
 
from __future__ import annotations
 
import legb_and_global as mod
 
 
def test_global_mutation() -> None:
    before = mod.count
    assert mod.bump() == before + 1
 
 
def test_local_shadow_and_closure_read() -> None:
    assert mod.local_shadow(99) == 99
    assert mod.read_outer() == 10
    assert mod.count >= 1