def testRuleBasedDispatcher(self):
# prepare data for test
box1 = box(0, 0, 100, 100)
box2 = box(0, 0, 10, 10)
dispatcher = RuleBasedDispatcher([CatchAllRule()], ["catchall"])
self.assertEqual(dispatcher.dispatch(None, box1), "catchall")
dispatch_batch = dispatcher.dispatch_batch(None, [box1, box2])
assert_array_equal(dispatch_batch, ["catchall", "catchall"])
labels, dispatch_map = dispatcher.dispatch_map(None, [box1, box2])
assert_array_equal(labels, dispatch_batch)
assert_array_equal(dispatch_map, [0, 0])
评论列表
文章目录