def test_property_there(self): class Foo(object): @property def attribute(self): return None foo = Foo() self.assertEqual(True, safe_hasattr(foo, 'attribute'))
def test_attribute_there(self): class Foo(object): pass foo = Foo() foo.attribute = None self.assertEqual(True, safe_hasattr(foo, 'attribute'))
def test_attribute_not_there(self): class Foo(object): pass self.assertEqual(False, safe_hasattr(Foo(), 'anything'))
def StackHidden(is_hidden): return AllMatch( AfterPreprocessing(lambda module: safe_hasattr(module, '__unittest'), Equals(is_hidden)))
def StackHidden(is_hidden): return AllMatch( AfterPreprocessing( lambda module: safe_hasattr(module, '__unittest'), Equals(is_hidden)))