示例#1
0
    def testNonJSONable(self):
        class Bug(object):
            pass

        bug = Bug()
        with self.assertRaises(TypeError):
            json_or_raw(bug)
示例#2
0
    def testNonJSONable(self):
        class Bug(object):
            pass

        bug = Bug()
        with self.assertRaises(TypeError):
            json_or_raw(bug)
示例#3
0
 def testNone(self):
     self.assertEqual(None, json_or_raw(None))
示例#4
0
 def testNormal(self):
     self.assertEqual('"Text"', json_or_raw("Text"))
     self.assertEqual('"T\' []ext"', json_or_raw("T' []ext"))
     self.assertEqual('"T\\"ext"', json_or_raw("T\"ext"))
示例#5
0
 def testNoJson(self):
     self.assertEqual("Text", NoJSON("Text"))
     self.assertEqual("Text", json_or_raw(NoJSON("Text")))
示例#6
0
 def testNone(self):
     self.assertEqual(None, json_or_raw(None))
示例#7
0
 def testNormal(self):
     self.assertEqual('"Text"', json_or_raw("Text"))
     self.assertEqual('"T\' []ext"', json_or_raw("T' []ext"))
     self.assertEqual('"T\\"ext"', json_or_raw('T"ext'))
示例#8
0
 def testNoJson(self):
     self.assertEqual("Text", NoJSON("Text"))
     self.assertEqual("Text", json_or_raw(NoJSON("Text")))