标签: python python-2.7 python-unittest
'我在单元测试中使用此功能:
def assertConditionally(a, b, condition): if condition: self.assertEqual(a, b) else: self.assertNotEqual(a, b)
还有其他办法吗?
答案 0 :(得分:3)
self.assertEqual(a == b, condition)