【发布时间】:2012-09-22 03:44:41
【问题描述】:
只是一点背景:这是一个类似于 STRIPS 的程序。 这个测试一直返回假,即使它应该是真的。从我在调试器中看到的应该是真的,我看不出为什么它会返回假。
感谢您的帮助。 调试器图片:
世界:
def __init__(self):
self.logic = {}
self.actions = {}
self.goals = set()
self.curr_state = set()
测试用例:
def setUp(self):
self.world = World()
def testWorldis_true(self):
pred = "on"
params = ("A", "B")
self.assertFalse(self.world.is_true(pred, params))
self.world.logic[pred] = params
self.assertTrue(self.world.is_true(pred, params))
输出:
======================================================================
FAIL: testWorldis_true (objorstrippertests.TestWorldFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
File ".stripperAssignment\src\objorstrippertests.py", line 54, in testWorldis_true
self.assertTrue(self.world.is_true(pred, params))
AssertionError: False is not true
【问题讨论】:
-
您将不得不为我们提供更多的合作机会。一些可执行的测试代码和一个测试用例怎么样?
-
@KeithRandall 补充了一点,够了吗?对不起,缺乏实质内容。
标签: python unit-testing debugging return