def test_to_json(self): obj = {"key": ["val1", 2, {1: 123123, 2: 234234}, True]} s = to_json(obj) self.assertEqual(s, '{"key": ["val1", 2, {1: 123123, 2: 234234}, true]}')
def test_to_json(self): murakami = to_json.Book() murakami.author = "H. Murakami" murakami.name = "Killing comrade" murakami.pages = "143" self.assertEqual(to_json.to_json(murakami), '{"author": "H. Murakami", "name": "Killing comrade", "pages": 143}')
def test_to_json_fail(self): obj = {"key": ["val1", 2, {1: 123123, 2: 234234}, True]} s = to_json(obj) self.assertFalse(s == "")