def METHOD_NAME(self, what: Optional[str], count: int) -> None:
    """
    Verify that observer performs an expected number of writes when the
    formatter returns a given value.
    @param what: the value for the formatter to return.
    @param count: the expected number of writes.
    """
    with DummyFile() as fileHandle:
        observer = FileLogObserver(cast(IO[Any], fileHandle), lambda e: what)
        event = dict(x=1)
        observer(event)
        self.assertEqual(fileHandle.writes, count)