def test_json_encoder(self): self.assertEqual(json_filter(True), 'true') self.assertEqual(json_filter(False), 'false') self.assertEqual(json_filter([1, 2, 3]), '[1, 2, 3]') self.assertEqual(json_filter((1, 2, 3)), '[1, 2, 3]') filtered_dict = json_filter({'item1': 1, 'item2': 2, 'item3': 3}) self.assertTrue('"item1": 1' in filtered_dict) self.assertTrue('"item2": 2' in filtered_dict) self.assertTrue('"item3": 3' in filtered_dict) today = now().today() self.assertEqual('"%s"' % today.isoformat()[:-3], json_filter(today))
def test_json_encoder(self): self.assertEqual(json_filter(True), 'true') self.assertEqual(json_filter(False), 'false') self.assertEqual(json_filter([1, 2, 3]), '[1, 2, 3]') self.assertEqual(json_filter((1, 2, 3)), '[1, 2, 3]') filtered_dict = json_filter({'item1': 1, 'item2': 2, 'item3': 3}) self.assertTrue('"item1": 1' in filtered_dict) self.assertTrue('"item2": 2' in filtered_dict) self.assertTrue('"item3": 3' in filtered_dict) today = now().today() self.assertEqual('"%s"' % today.isoformat()[:-3], json_filter(today))