def test_observeFlushes(self):
        """
        L{FileLogObserver} calles C{flush()} on the output file when it
        observes an event.
        """
        with DummyFile() as fileHandle:
            observer = FileLogObserver(fileHandle, lambda e: unicode(e))
            event = dict(x=1)
            observer(event)
            self.assertEqual(fileHandle.flushes, 1)

        L{FileLogObserver} calles C{flush()} on the output file when it
        observes an event.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/logger/test/test_file.py