コード例 #1
0
    def test_object_has_the_attribute___attribute_value_is_returned(self):
        class A(object):
            foo = 'bar'

        res = tags.getattr(A(), 'foo,boo')

        self.assertEqual('bar', res)
コード例 #2
0
    def test_object_does_not_have_the_attribute_no_default_is_set___empty_string_is_returned(self):
        class A(object):
            foo = 'bar'

        res = tags.getattr(A(), 'bar')

        self.assertEqual('', res)
コード例 #3
0
    def test_object_has_the_attribute___attribute_value_is_returned(self):
        class A(object):
            foo = 'bar'

        res = tags.getattr(A(), 'foo,boo')

        self.assertEqual('bar', res)
コード例 #4
0
    def test_object_does_not_have_the_attribute_no_default_is_set___empty_string_is_returned(
            self):
        class A(object):
            foo = 'bar'

        res = tags.getattr(A(), 'bar')

        self.assertEqual('', res)
コード例 #5
0
    def test_object_has_the_attribute_which_is_callable___attribute_return_value_is_returned(self):
        class A(object):
            def foo(self):
                return 'bar'

        res = tags.getattr(A(), 'foo,boo')

        self.assertEqual('bar', res)
コード例 #6
0
    def test_object_has_the_attribute_which_is_callable___attribute_return_value_is_returned(
            self):
        class A(object):
            def foo(self):
                return 'bar'

        res = tags.getattr(A(), 'foo,boo')

        self.assertEqual('bar', res)