本文整理汇总了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)