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


Python unittest.main函数代码示例

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


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

示例1: tearDown

#    def tearDown(self):
#        print "Tear down"

    #### How to set up the network communication ??? ###

    # operation = remote server's method name, data_in & expecte are
    # the input and expected outputs
    def _test(self, operation, data_in, expected):
        self.proto.dataReceived('%s %s\r\n' % (operation, data_in))
        result = self.tr.value().rstrip()
        print "_test received: '%s'" % result
        self.assertEqual(result, expected)
        self.tr.clear()

    # nothing after initialization the server state should be in SETUP
    def test_server_current_state(self):
        self._test('current_state', "", "RUNNING")

    # after "FTP" command the server state should be waiting for FTP commands
    def test_server_switch_state(self):
        self._test('switch_state', "", "END")

    # def test_ftp_connect(self):
    #     self.factory
        

if __name__ == '__main__':
    unittest.main()    


开发者ID:aknackiron,项目名称:telnet-server-app,代码行数:28,代码来源:test_RemoteStateMachine.py

示例2: main

def main():
    unittest.main()
开发者ID:Callek,项目名称:build-buildbotcustom,代码行数:2,代码来源:test_misc_merging.py

示例3: cb

        proc = _twisted.AMF3RequestProcessor(gw)

        request = remoting.Request('null', body=[messaging.RemotingMessage(body=[None], destination='spam', operation='eggs')])

        def cb(result):
            try:
                self.assertTrue(result)
            except:
                d.errback()
            else:
                d.callback(None)

        proc(request).addCallback(cb).addErrback(lambda failure: d.errback())

        return d

def suite():
    import unittest

    suite = unittest.TestSuite()

    suite.addTest(unittest.makeSuite(TwistedServerTestCase))
    suite.addTest(unittest.makeSuite(TwistedGatewayTestCase))
    suite.addTest(unittest.makeSuite(AMF0RequestProcessorTestCase))
    suite.addTest(unittest.makeSuite(AMF3RequestProcessorTestCase))

    return suite

if __name__ == '__main__':
    unittest.main(defaultTest='suite')
开发者ID:weimingtom,项目名称:o-healer-projects,代码行数:30,代码来源:test_twisted.py

示例4: cb

        def cb(result):
            msg = result.body

            try:
                self.assertTrue(isinstance(msg, messaging.AcknowledgeMessage))
            except:
                d.errback()
            else:
                d.callback(None)

        proc(request).addCallback(cb).addErrback(lambda failure: d.errback())

        return d


def suite():
    import unittest

    suite = unittest.TestSuite()

    suite.addTest(unittest.makeSuite(TwistedServerTestCase))
    suite.addTest(unittest.makeSuite(TwistedGatewayTestCase))
    suite.addTest(unittest.makeSuite(AMF0RequestProcessorTestCase))
    suite.addTest(unittest.makeSuite(AMF3RequestProcessorTestCase))

    return suite


if __name__ == "__main__":
    unittest.main(defaultTest="suite")
开发者ID:wogooo,项目名称:TowerSaint,代码行数:30,代码来源:test_twisted.py


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