def METHOD_NAME(self):
    doc = TerminalTextDocument()
    writer = TextStream()
    doc.connectStream(writer)
    writer.write("A")
    doc_c = doc.clone()
    writer.write("B")
    self.assertEqual(doc.toPlainText(), "AB")
    self.assertEqual(doc_c.toPlainText(), "AB")
    writer_err = TextStream()
    cf = QTextCharFormat()
    cf.setForeground(QColor(Qt.red))
    doc_c.connectStream(writer_err, cf)
    writer_err.write("C")
    self.assertEqual(doc_c.toPlainText(), "ABC")
    self.assertEqual(doc.toPlainText(), "AB")
    doc_c.disconnectStream(writer_err)
    writer_err.write("D")
    self.assertEqual(doc_c.toPlainText(), "ABC")