def test_trace(self):
        """
        Tracing keeps track of forwarding to observers.
        """
        event = dict(foo=1, bar=2, log_trace=[])

        traces = {}

        # Copy trace to a tuple; otherwise, both observers will store the same
        # mutable list, and we won't be able to see o1's view distinctly.
        o1 = lambda e: traces.setdefault(1, tuple(e["log_trace"]))
        o2 = lambda e: traces.setdefault(2, tuple(e["log_trace"]))

        publisher = LogPublisher(o1, o2)
        publisher(event)

        self.assertEqual(traces[1], ((publisher, o1),))
        self.assertEqual(traces[2], ((publisher, o1), (publisher, o2)))

        Tracing keeps track of forwarding to observers.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/test/test_observer.py