Exemplo n.º 1
0
    def testNonJSONable(self):
        class Bug(object):
            pass

        bug = Bug()
        with self.assertRaises(TypeError):
            json_or_raw(bug)
Exemplo n.º 2
0
    def testNonJSONable(self):
        class Bug(object):
            pass

        bug = Bug()
        with self.assertRaises(TypeError):
            json_or_raw(bug)
Exemplo n.º 3
0
 def testNone(self):
     self.assertEqual(None, json_or_raw(None))
Exemplo n.º 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"))
Exemplo n.º 5
0
 def testNoJson(self):
     self.assertEqual("Text", NoJSON("Text"))
     self.assertEqual("Text", json_or_raw(NoJSON("Text")))
Exemplo n.º 6
0
 def testNone(self):
     self.assertEqual(None, json_or_raw(None))
Exemplo n.º 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'))
Exemplo n.º 8
0
 def testNoJson(self):
     self.assertEqual("Text", NoJSON("Text"))
     self.assertEqual("Text", json_or_raw(NoJSON("Text")))