本文整理匯總了Python中vai.models.TextDocument.TextDocument.documentText方法的典型用法代碼示例。如果您正苦於以下問題:Python TextDocument.documentText方法的具體用法?Python TextDocument.documentText怎麽用?Python TextDocument.documentText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vai.models.TextDocument.TextDocument
的用法示例。
在下文中一共展示了TextDocument.documentText方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testReplaceFromMemento
# 需要導入模塊: from vai.models.TextDocument import TextDocument [as 別名]
# 或者: from vai.models.TextDocument.TextDocument import documentText [as 別名]
def testReplaceFromMemento(self):
doc = TextDocument()
with open(fixtures.get("basic_nonempty_file.txt"), "r") as f:
doc.read(f)
doc.createLineMetaInfo("whatever")
initial_text = doc.documentText()
meta_info1 = doc.lineMetaInfo("whatever")
meta_info1.setData("hello", 1)
memento = doc.lineMemento(1)
doc.insertChars((1, 1), "gnakgnak")
meta_info1.setData("byebye", 1)
doc.replaceFromMemento(1, memento)
self.assertEqual(doc.documentText(), initial_text)
self.assertEqual(meta_info1.data(1), "hello")
示例2: testInitEmpty
# 需要導入模塊: from vai.models.TextDocument import TextDocument [as 別名]
# 或者: from vai.models.TextDocument.TextDocument import documentText [as 別名]
def testInitEmpty(self):
doc = TextDocument()
self.assertTrue(doc.isEmpty())
self.assertEqual(doc.filename(), None)
self.assertFalse(doc.isModified())
self.assertEqual(doc.numLines(), 1)
self.assertEqual(doc.documentText(), '\n')
示例3: testInitFromNonEmptyFile
# 需要導入模塊: from vai.models.TextDocument import TextDocument [as 別名]
# 或者: from vai.models.TextDocument.TextDocument import documentText [as 別名]
def testInitFromNonEmptyFile(self):
doc = TextDocument()
with open(fixtures.get("basic_nonempty_file.txt"), "r") as f:
doc.read(f)
self.assertFalse(doc.isEmpty())
self.assertEqual(doc.numLines(), 2)
self.assertEqual(doc.documentText(), "hello\nhow are you?\n")
示例4: testInitFromEmptyFile
# 需要導入模塊: from vai.models.TextDocument import TextDocument [as 別名]
# 或者: from vai.models.TextDocument.TextDocument import documentText [as 別名]
def testInitFromEmptyFile(self):
doc = TextDocument()
with open(fixtures.get("empty_file.txt"), "r") as f:
doc.read(f)
self.assertTrue(doc.isEmpty())
self.assertEqual(doc.numLines(), 1)
self.assertEqual(doc.documentText(), "\n")
示例5: testInitFromNonEmptyFile
# 需要導入模塊: from vai.models.TextDocument import TextDocument [as 別名]
# 或者: from vai.models.TextDocument.TextDocument import documentText [as 別名]
def testInitFromNonEmptyFile(self):
doc = TextDocument()
doc.open(fixtures.get("basic_nonempty_file.txt"))
self.assertFalse(doc.isEmpty())
self.assertEqual(doc.filename(), fixtures.get("basic_nonempty_file.txt"))
self.assertFalse(doc.isModified())
self.assertEqual(doc.numLines(), 2)
self.assertEqual(doc.documentText(), 'hello\nhow are you?\n')
示例6: testInitFromEmptyFile
# 需要導入模塊: from vai.models.TextDocument import TextDocument [as 別名]
# 或者: from vai.models.TextDocument.TextDocument import documentText [as 別名]
def testInitFromEmptyFile(self):
doc = TextDocument()
doc.open(fixtures.get("empty_file.txt"))
self.assertTrue(doc.isEmpty())
self.assertEqual(doc.filename(), fixtures.get("empty_file.txt"))
self.assertFalse(doc.isModified())
self.assertEqual(doc.numLines(), 1)
self.assertEqual(doc.documentText(), '\n')
示例7: testInitEmpty
# 需要導入模塊: from vai.models.TextDocument import TextDocument [as 別名]
# 或者: from vai.models.TextDocument.TextDocument import documentText [as 別名]
def testInitEmpty(self):
doc = TextDocument()
self.assertTrue(doc.isEmpty())
self.assertEqual(doc.numLines(), 1)
self.assertEqual(doc.documentText(), "\n")