Use stricter getattr() checks for decorator functions

Explicit checks for "is True" prevents unexpected behaviour with objects
that are callable and have permissive gettatr(), such as Mock.

Fixes #1145
5 files changed