예제 #1
0
class Class(object):
    @tracing.trace
    @classmethod
    def class_method(cls):
        pass

    @tracing.trace
    @staticmethod
    def static_method():
        pass

    __test = None

    def _test_get(self):
        return self.__test

    def _test_set(self, value):
        self.__test = value

    test = tracing.trace(property(_test_get, _test_set))

    @tracing.trace
    def method(self, some, other='value', *args, **kwds):
        pass

    def __repr__(self):
        """Generate a deterministic string for testing."""
        return '<Class instance>'
예제 #2
0
    def test_injected(self):

        with self.capture:
            tracing.trace(Class2, recursive=True)
            Class2.class_method()
            Class2.static_method()
            test = Class2()
            test.test = 1
            assert 1 == test.test
            test.method()

            self.assertEqual(self.capture.getvalue(),
                         ">> Class2.class_method(cls=<type 'Class2'>)\n" +
                         "<< Class2.class_method\n"
                         ">> static_method()\n"
                         "<< static_method\n")