Exemple #1
0
    def runTest(self):
        index = 0
        for JSON in JSONS:
            index = index + 1
            cj = CCJson()
            cj.loads(JSON)

            # json format
            jfile = fn + str(index) + '.json'
            f = open(jfile, 'w')
            cj.dump(f)
            f.close()
            jres = CCJson()
            f = open(jfile, 'r')
            jres.load(f)
            f.close()
            self.assertEquals(cj._dd, jres._dd)
            # python format
            pfile = fn + str(index) + '.pj'
            f = open(pfile, 'w')
            cj.dump_python(f)
            f.close()
            pres = CCJson()
            f = open(pfile, 'r')
            pres.load_python(f)
            f.close()
            self.assertEquals(cj._dd, pres._dd)
Exemple #2
0
    def runTest(self):
        index = 0
        for JSON in JSONS:
            index = index + 1
            cj = CCJson()
            cj.loads(JSON)

            # json format
            jfile = fn + str(index) + '.json'
            f = open(jfile, 'w')
            cj.dump(f)
            f.close()
            jres = CCJson()
            f = open(jfile, 'r')
            jres.load(f)
            f.close()
            self.assertEquals(cj._dd, jres._dd)
            # python format
            pfile = fn + str(index) + '.pj'
            f = open(pfile, 'w')
            cj.dump_python(f)
            f.close()
            pres = CCJson()
            f = open(pfile, 'r')
            pres.load_python(f)
            f.close()
            self.assertEquals(cj._dd, pres._dd)