assertIn
を使用して、JSON文字列の結果の一部が正しいことをテストしています。Python assertInテストステートメントが文字列を見つけられませんか?
test_json = some_function_returning_a_dict()
self.assertIn(expected_json, test_json, "did not match expected output")
エラーが
AssertionError: "'abc': '1.0012'," not found in [{'abc': '1.0012',...
Iは、内側列上Ctrl + F
を使用し、それは結果の文字列であっあります。私は、Python 3.0
dictはJSON文字列ではなく、JSON文字列の検証には恐ろしい方法です。 – user2357112