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


Python Controller.do_text_load方法代码示例

本文整理汇总了Python中Controller.Controller.do_text_load方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.do_text_load方法的具体用法?Python Controller.do_text_load怎么用?Python Controller.do_text_load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller.Controller的用法示例。


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

示例1: test_TextLoad_01

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import do_text_load [as 别名]
    def test_TextLoad_01(self, mockMeth):
        """
        Load a record from text, test for correct attribute parsing
        - This test does not add coverage if test_TextLoad_02 is exercised
        - Asserted by expecting TestView().show() to get a message,
           representing the record in the same string format
        """
        expID = "A001"
        expGender = "F"
        expAge = 36
        expSales = 92
        expBMI = "Normal"
        expIncome = 700
        theData = "{} {} {} {} {} {}".format(expID, expGender, expAge,
                                             expSales, expBMI, expIncome)

        mockMeth.return_value = StringIO(theData)
        theController = Controller(TestView.TestView(), None)
        theController.do_text_load("")

        TestView.clearLog()
        expectedMessage = theData + "\n"
        theController.do_view_records("")
        actualMessage = TestView.theLog[0]
        self.assertEqual(expectedMessage, actualMessage)
开发者ID:acr79,项目名称:BCPR301_LegacySystem,代码行数:27,代码来源:UT_FilerFunctionality.py

示例2: test_TextLoad_03

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import do_text_load [as 别名]
    def test_TextLoad_03(self, mockMeth):
        """
        Handles IOError
        - Because the IOError message is expected to be determined by the
           IOError constructor, the message will be randomised
        """
        message = str(random.randrange(100))
        mockMeth.side_effect = IOError(message)
        theController = Controller(TestView.TestView(), None)

        TestView.clearLog()
        theController.do_text_load("")
        expectedShow = "EXCEPTION: {}\n".format(message)
        actualShow = TestView.theLog[0]
        self.assertEqual(expectedShow, actualShow)
开发者ID:acr79,项目名称:BCPR301_LegacySystem,代码行数:17,代码来源:UT_FilerFunctionality.py

示例3: test_TextLoad_02

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import do_text_load [as 别名]
    def test_TextLoad_02(self, mockMeth):
        """
        Can handle bad lines in text load
        - Line 2 in textData (between \n\n) is bad as nothing can be
           interpreted
        - Also 2 records will be added
        """
        textData = "a001 f 36 92 normal 700\n\nb222 m 1 1 normal 9"
        mockMeth.return_value = StringIO(textData)
        theController = Controller(TestView.TestView(), None)

        TestView.clearLog()
        theController.do_text_load("")
        expectedShow = "Records Added: 2\nProblems: \nBAD LINE 2: 'Not Enough \
Arguments Provided'\n\n"
        actualShow = TestView.theLog[0]
        self.assertEqual(expectedShow, actualShow)
开发者ID:acr79,项目名称:BCPR301_LegacySystem,代码行数:19,代码来源:UT_FilerFunctionality.py


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