本文整理汇总了Python中vai.models.TextDocument.TextDocument.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Python TextDocument.isEmpty方法的具体用法?Python TextDocument.isEmpty怎么用?Python TextDocument.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vai.models.TextDocument.TextDocument
的用法示例。
在下文中一共展示了TextDocument.isEmpty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testDeleteLine2
# 需要导入模块: from vai.models.TextDocument import TextDocument [as 别名]
# 或者: from vai.models.TextDocument.TextDocument import isEmpty [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 isEmpty [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: testInitEmpty
# 需要导入模块: from vai.models.TextDocument import TextDocument [as 别名]
# 或者: from vai.models.TextDocument.TextDocument import isEmpty [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')
示例4: testInitFromNonEmptyFile
# 需要导入模块: from vai.models.TextDocument import TextDocument [as 别名]
# 或者: from vai.models.TextDocument.TextDocument import isEmpty [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")
示例5: testInitFromEmptyFile
# 需要导入模块: from vai.models.TextDocument import TextDocument [as 别名]
# 或者: from vai.models.TextDocument.TextDocument import isEmpty [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")
示例6: testInitFromNonEmptyFile
# 需要导入模块: from vai.models.TextDocument import TextDocument [as 别名]
# 或者: from vai.models.TextDocument.TextDocument import isEmpty [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')
示例7: testInitFromEmptyFile
# 需要导入模块: from vai.models.TextDocument import TextDocument [as 别名]
# 或者: from vai.models.TextDocument.TextDocument import isEmpty [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')
示例8: testDeleteLine2
# 需要导入模块: from vai.models.TextDocument import TextDocument [as 别名]
# 或者: from vai.models.TextDocument.TextDocument import isEmpty [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())
示例9: testInitEmpty
# 需要导入模块: from vai.models.TextDocument import TextDocument [as 别名]
# 或者: from vai.models.TextDocument.TextDocument import isEmpty [as 别名]
def testInitEmpty(self):
doc = TextDocument()
self.assertTrue(doc.isEmpty())
self.assertEqual(doc.numLines(), 1)
self.assertEqual(doc.documentText(), "\n")