当前位置: 首页>>代码示例>>Python>>正文


Python fixtures.get函数代码示例

本文整理汇总了Python中tests.fixtures.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testLineLength

    def testLineLength(self):
        doc = TextDocument(fixtures.get("basic_nonempty_file.txt"))
        self.assertEqual(doc.lineLength(1), 6)
        self.assertEqual(doc.lineLength(2), 13)

        doc = TextDocument(fixtures.get("empty_file.txt"))
        self.assertEqual(doc.lineLength(1), 1)
开发者ID:maiconpl,项目名称:vix,代码行数:7,代码来源:test_TextDocument.py

示例2: testInitFromEmptyFile

    def testInitFromEmptyFile(self):
        doc = TextDocument(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')
开发者ID:maiconpl,项目名称:vix,代码行数:8,代码来源:test_TextDocument.py

示例3: testInitFromNonEmptyFile

    def testInitFromNonEmptyFile(self):
        doc = TextDocument(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')
开发者ID:maiconpl,项目名称:vix,代码行数:8,代码来源:test_TextDocument.py

示例4: testLineLength

    def testLineLength(self):
        doc = TextDocument()
        with open(fixtures.get("basic_nonempty_file.txt"), "r") as f:
            doc.read(f)
        self.assertEqual(doc.lineLength(1), 6)
        self.assertEqual(doc.lineLength(2), 13)

        doc = TextDocument()
        with open(fixtures.get("empty_file.txt"), "r") as f:
            doc.read(f)
        self.assertEqual(doc.lineLength(1), 1)
开发者ID:rsdenijs,项目名称:vai,代码行数:11,代码来源:test_TextDocument.py

示例5: testUpdateDocumentMeta

 def testUpdateDocumentMeta(self):
     doc = TextDocument()
     with open(fixtures.get("basic_nonempty_file.txt"), "r") as f:
         doc.read(f)
     doc.createDocumentMetaInfo("Hello")
     doc.documentMetaInfo("Hello").setData(5)
     self.assertEqual(doc.documentMetaInfo("Hello").data(), 5)
开发者ID:rsdenijs,项目名称:vai,代码行数:7,代码来源:test_TextDocument.py

示例6: testDeleteChars

    def testDeleteChars(self):
        doc = TextDocument()
        with open(fixtures.get("basic_nonempty_file.txt"), "r") as f:
            doc.read(f)

        self.assertRaises(ValueError, lambda: doc.deleteChars((1, 3), -1))

        d = doc.deleteChars((1, 3), 1)
        self.assertEqual(doc.lineText(1), "helo\n")
        self.assertEqual(d[0], "l")

        d = doc.deleteChars((1, 2), 100)
        self.assertEqual(doc.lineText(1), "h\n")
        self.assertEqual(d[0], "elo")

        d = doc.deleteChars((1, 2), 100)
        self.assertEqual(doc.lineText(1), "h\n")
        self.assertEqual(d[0], "")

        d = doc.deleteChars((1, 1), 100)
        self.assertEqual(doc.lineText(1), "\n")
        self.assertEqual(d[0], "h")

        d = doc.deleteChars((1, 1), 100)
        self.assertEqual(doc.lineText(1), "\n")
        self.assertEqual(d[0], "")
开发者ID:rsdenijs,项目名称:vai,代码行数:26,代码来源:test_TextDocument.py

示例7: testBreakLine

 def testBreakLine(self):
     doc = TextDocument()
     with open(fixtures.get("basic_nonempty_file.txt"), "r") as f:
         doc.read(f)
     doc.breakLine((1, 3))
     self.assertEqual(doc.lineText(1), "he\n")
     self.assertEqual(doc.lineText(2), "llo\n")
开发者ID:rsdenijs,项目名称:vai,代码行数:7,代码来源:test_TextDocument.py

示例8: testCharMeta

 def testCharMeta(self):
     doc = TextDocument()
     with open(fixtures.get("basic_nonempty_file.txt"), "r") as f:
         doc.read(f)
     doc.updateCharMeta((1, 1), {"Hello": [1]})
     self.assertEqual(len(doc.charMeta((1, 1))["Hello"]), len(doc.lineText(1)))
     self.assertEqual(doc.charMeta((1, 1))["Hello"], [1, None, None, None, None, None])
开发者ID:rsdenijs,项目名称:vai,代码行数:7,代码来源:test_TextDocument.py

示例9: testDeleteChars

    def testDeleteChars(self):
        doc = TextDocument()
        doc.open(fixtures.get("basic_nonempty_file.txt"))

        self.assertRaises(ValueError, lambda : doc.deleteChars((1,3), -1))

        d = doc.deleteChars( (1,3), 1)
        self.assertEqual(doc.lineText(1), 'helo\n')
        self.assertEqual(d[0], 'l')

        d = doc.deleteChars( (1,2), 100)
        self.assertEqual(doc.lineText(1), 'h\n')
        self.assertEqual(d[0], 'elo')

        d = doc.deleteChars( (1,2), 100)
        self.assertEqual(doc.lineText(1), 'h\n')
        self.assertEqual(d[0], '')

        d = doc.deleteChars( (1,1), 100)
        self.assertEqual(doc.lineText(1), '\n')
        self.assertEqual(d[0], 'h')

        d = doc.deleteChars( (1,1), 100)
        self.assertEqual(doc.lineText(1), '\n')
        self.assertEqual(d[0], '')
开发者ID:gavd89,项目名称:vai,代码行数:25,代码来源:test_TextDocument.py

示例10: testGetBufferCursorPos

    def testGetBufferCursorPos(self):
        f = fixtures.get("editor_state")
        EditorState.editorStatePath = lambda x : f
        state = EditorState.instance()

        self.assertEqual(state.cursorPosForPath('foobar'), (1,2))
        self.assertEqual(state.cursorPosForPath('notpresent'), None)
开发者ID:gavd89,项目名称:vai,代码行数:7,代码来源:test_EditorState.py

示例11: testLastModified

 def testLastModified(self):
     doc = TextDocument(fixtures.get("basic_nonempty_file.txt"))
     last_modified = doc.lastModified()
     self.assertEqual(doc.lastModified(), last_modified)
     time.sleep(0.1)
     doc.insertLine(1,"")
     self.assertNotEqual(doc.lastModified(), last_modified)
开发者ID:maiconpl,项目名称:vix,代码行数:7,代码来源:test_TextDocument.py

示例12: testJoinWithNextLine2

 def testJoinWithNextLine2(self):
     doc = TextDocument(fixtures.get("basic_nonempty_file.txt"))
     doc.joinWithNextLine(2)
     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())
开发者ID:maiconpl,项目名称:vix,代码行数:7,代码来源:test_TextDocument.py

示例13: testDeleteDocumentMeta

 def testDeleteDocumentMeta(self):
     doc = TextDocument()
     doc.open(fixtures.get("basic_nonempty_file.txt"))
     doc.updateDocumentMeta({"Hello": 5})
     self.assertEqual(doc.documentMeta()["Hello"], 5)
     doc.deleteDocumentMeta("Hello")
     self.assertNotIn("Hello", doc.documentMeta())
开发者ID:gavd89,项目名称:vai,代码行数:7,代码来源:test_TextDocument.py

示例14: testUpdateLineMeta

    def testUpdateLineMeta(self):
        doc = TextDocument(fixtures.get("basic_nonempty_file.txt"))
        doc.updateLineMeta(1, {"hello": 5})
        self.assertEqual(type(doc.lineMeta(1)), dict)
        self.assertEqual(doc.lineMeta(1)["hello"], 5)

        self.assertRaises(IndexError, lambda : doc.updateLineMeta(20, {}))
开发者ID:maiconpl,项目名称:vix,代码行数:7,代码来源:test_TextDocument.py

示例15: testInitFromFile

    def testInitFromFile(self):

        filename = fixtures.get("example_configuration.rc")

        config = Configuration.initFromFile(filename)

        self.assertEqual(config['colors.status_bar.fg'], 'red')
开发者ID:gavd89,项目名称:vai,代码行数:7,代码来源:test_Configuration.py


注:本文中的tests.fixtures.get函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。