[英]"AssertionError: False is not True" When I am trying to run my code
I am getting an error on this function:我在这个 function 上收到错误消息:
def test_returns_true_when_feature_is_enabled(self):
# Arrange
mock_client = mock.MagicMock()
mock_client.is_feature_enabled.return_value = True
with patch.object(fullstack_service, 'get_optly_object', return_value=mock_client):
with patch('services.js_validator.js_validator_service_rollout._get_account_id', return_value=123):
# Act / Assert
self.assertTrue(should_use_js_validator_service())
The error I get is:我得到的错误是:
AssertionError: False is not true
test/services_test/js_validator_test/js_validator_service_rollout_test.py:44: AssertionError
How can I fix this?我怎样才能解决这个问题?
With a liberal use of the Inte.net, I found that on GeeksforGeeks , when the first parameter is False
, assertTrue
fails the test and prints the (seemingly optional) second parameter.通过自由使用 Inte.net,我发现在GeeksforGeeks上,当第一个参数为
False
时, assertTrue
失败并打印(看似可选的)第二个参数。 When the first parameter is True
, it doesn't do anything.当第一个参数为
True
时,它什么都不做。 The issue is that the function should_use_js_validator_service()
, which you have passed to assertTrue
, does not return a truthy value.问题是您传递给
assertTrue
的 function should_use_js_validator_service()
没有返回真值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.