本文整理匯總了Python中sample.ObjectType.processEvent方法的典型用法代碼示例。如果您正苦於以下問題:Python ObjectType.processEvent方法的具體用法?Python ObjectType.processEvent怎麽用?Python ObjectType.processEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sample.ObjectType
的用法示例。
在下文中一共展示了ObjectType.processEvent方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testCpp
# 需要導入模塊: from sample import ObjectType [as 別名]
# 或者: from sample.ObjectType import processEvent [as 別名]
def testCpp(self):
'''C++ calling C++ virtual method in multiple inheritance scenario'''
obj = ImplementsNone()
self.assert_(ObjectType.processEvent([obj], Event(Event.BASIC_EVENT)))
self.assertRaises(AttributeError, getattr, obj, 'event_processed')
self.assertEqual(obj.callSum0(1, 2, 3), 6)
示例2: testEvent
# 需要導入模塊: from sample import ObjectType [as 別名]
# 或者: from sample.ObjectType import processEvent [as 別名]
def testEvent(self):
'''C++ calling Python reimplementation of virtual in multiple inheritance'''
obj = ImplementsBoth()
self.assert_(ObjectType.processEvent([obj], Event(Event.BASIC_EVENT)))
self.assert_(obj.event_processed)
self.assertEqual(obj.callSum1(1, 2, 3), 12)
示例3: testEventLoop
# 需要導入模塊: from sample import ObjectType [as 別名]
# 或者: from sample.ObjectType import processEvent [as 別名]
def testEventLoop(self):
'''Calling virtuals in a event loop'''
objs = [ObjectType(), NoOverride(), Override()]
evaluated = ObjectType.processEvent(objs,
Event(Event.BASIC_EVENT))
self.assertEqual(evaluated, 3)
self.assert_(objs[2].called)
示例4: testBasic
# 需要導入模塊: from sample import ObjectType [as 別名]
# 或者: from sample.ObjectType import processEvent [as 別名]
def testBasic(self):
'''Allowing threads and calling virtuals from C++'''
number = 10
objs = [Producer() for x in range(number)]
thread = Collector(objs)
thread.start()
evaluated = ObjectType.processEvent(objs,
Event(Event.BASIC_EVENT))
thread.join()
producer_data = [x.data for x in objs]
self.assertEqual(evaluated, number)
self.assertEqual(producer_data, thread.data)