def testSetJsondecode(self): jsondecode = pg.get_jsondecode() try: pg.set_jsondecode(None) r = pg.get_jsondecode() self.assertIsNone(r) pg.set_jsondecode(str) r = pg.get_jsondecode() self.assertIs(r, str) self.assertRaises(TypeError, pg.set_jsondecode, 'invalid') finally: pg.set_jsondecode(jsondecode) r = pg.get_jsondecode() self.assertIs(r, jsondecode)