Exemple #1
0
 def test_property_there(self):
     class Foo(object):
         @property
         def attribute(self):
             return None
     foo = Foo()
     self.assertEqual(True, safe_hasattr(foo, 'attribute'))
Exemple #2
0
    def test_attribute_there(self):
        class Foo(object):
            pass

        foo = Foo()
        foo.attribute = None
        self.assertEqual(True, safe_hasattr(foo, 'attribute'))
Exemple #3
0
    def test_property_there(self):
        class Foo(object):
            @property
            def attribute(self):
                return None

        foo = Foo()
        self.assertEqual(True, safe_hasattr(foo, 'attribute'))
Exemple #4
0
    def test_attribute_not_there(self):
        class Foo(object):
            pass

        self.assertEqual(False, safe_hasattr(Foo(), 'anything'))
Exemple #5
0
 def test_attribute_there(self):
     class Foo(object):
         pass
     foo = Foo()
     foo.attribute = None
     self.assertEqual(True, safe_hasattr(foo, 'attribute'))
Exemple #6
0
 def test_attribute_not_there(self):
     class Foo(object):
         pass
     self.assertEqual(False, safe_hasattr(Foo(), 'anything'))
Exemple #7
0
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)))