def test_local_and_global_extraction(): def a_closure(): pass def fun(): global_gets_called() a_closure() assert extract_functions(fun) == [a_closure, global_gets_called]
def test_multiple_local_extraction(): def local1(): pass def local2(): pass def fun(): local1() local2() assert extract_functions(fun) == [local1, local2]
def test_multiple_local_global_extraction(): def local1(): pass def local2(): pass def fun(): local1() local2() another_global() global_gets_called() assert extract_functions(fun) == [local1, local2, global_gets_called, another_global]
def test_multiple_global_extraction(): def fun(): global_gets_called() another_global() assert extract_functions(fun) == [another_global, global_gets_called]
def test_closure_fun_extraction(): def closure_is_called(): pass def fun(): closure_is_called() assert extract_functions(fun) == [closure_is_called]
def test_global_fun_extraction(): def fun(): global_gets_called() assert extract_functions(fun) == [global_gets_called]
def test_builtin_fun_extraction(): def fun(): len([1, 2, 3]) assert extract_functions(fun) == [len]