def test_get_function_closure(): def f(): x = 42 def g(): return x return g cell = six.get_function_closure(f())[0] assert type(cell).__name__ == "cell"