def METHOD_NAME(self) -> Generator["defer.Deferred[object]", object, None]:
    string_file = BytesIO()
    consumer = BackgroundFileConsumer(string_file, reactor=reactor)
    try:
        producer = DummyPullProducer()
        yield producer.register_with_consumer(consumer)
        yield producer.write_and_wait(b"Foo")
        self.assertEqual(string_file.getvalue(), b"Foo")
        yield producer.write_and_wait(b"Bar")
        self.assertEqual(string_file.getvalue(), b"FooBar")
    finally:
        consumer.unregisterProducer()
    yield consumer.wait()  # type: ignore[misc]
    self.assertTrue(string_file.closed)