How can I test whether a variable holds a lambda?

Viewed 17632

Is there a way to test whether a variable holds a lambda? The context is I'd like to check a type in a unit test:

self.assertEquals(lambda, type(myVar))

The type seems to be "function" but I didn't see any obvious builtin type to match it. Obviously, I could write this, but it feels clumsy:

self.assertEquals(type(lambda m: m), type(myVar))
5 Answers
Related