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