本文整理汇总了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()
示例2: main
def main():
unittest.main()
示例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')
示例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")