def METHOD_NAME(self):
    # test the various extended flavors of function.new
    def f(x):
        def g(y):
            return x + y
        return g
    g = f(4)
    new.function(f.func_code, {}, "blah")
    g2 = new.function(g.func_code, {}, "blah", (2,), g.func_closure)
    self.assertEqual(g2(), 6)
    g3 = new.function(g.func_code, {}, "blah", None, g.func_closure)
    self.assertEqual(g3(5), 9)
    def test_closure(func, closure, exc):
        self.assertRaises(exc, new.function, func.func_code, {}, "", None, closure)
    test_closure(g, None, TypeError) # invalid closure
    test_closure(g, (1,), TypeError) # non-cell in closure
    test_closure(g, (1, 1), ValueError) # closure is wrong size
    test_closure(f, g.func_closure, ValueError) # no closure needed