• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python fixtures.get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testUpdateCharMeta

 def testUpdateCharMeta(self):
     doc = TextDocument()
     doc.open(fixtures.get("basic_nonempty_file.txt"))
     doc.updateCharMeta( (1, 3), { "foo" : ["a", "a"],
                                   "bar" : ['b', None, 'b'],
                                 }
                       )
开发者ID:gavd89,项目名称:vai,代码行数:7,代码来源:test_TextDocument.py


示例17: testDeleteLine2

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


示例18: testInitFromNonEmptyFile

    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")
开发者ID:rsdenijs,项目名称:vai,代码行数:8,代码来源:test_TextDocument.py


示例19: testInitFromEmptyFile

    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")
开发者ID:rsdenijs,项目名称:vai,代码行数:8,代码来源:test_TextDocument.py


示例20: testInitFromFile

    def testInitFromFile(self):

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

        Configuration.setFilename(filename)
        config = Configuration.instance()

        self.assertNotEqual(config['colors.status_bar.fg'], None)
开发者ID:UtahDave,项目名称:vai,代码行数:8,代码来源:test_Configuration.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python fixtures.loop函数代码示例发布时间:2022-05-27
下一篇:
Python fakes.assert_has_keys函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap