Example #1
0
    def test_parse(m):
        c1 = json.dumps(m)
        d0 = json.loads(c1)

        d1 = JsonParser.loads(c1)

        c2 = json.dumps(m, indent=4)
        d2 = JsonParser.loads(c2)

        assert d0 == d1
        assert d0 == d2
Example #2
0
 def test_loads(self):
     print('{line}TESTING loads{line}'.format(line="-" * 50))
     argv.append('-s')
     for k, v in inputs.items():
         if len(argv) == 2:
             argv.append(v)
         else:
             argv[2] = v
         try:
             val = JsonParser.loads(v)
             if k in specific_loads_values.keys():
                 self.assertEqual(specific_loads_values[k], val)
             else:
                 self.assertEqual(inputo[k], val)
             print(f'SUCCESS Tested value - {v}')
         except SyntaxError as e:
             print(f'FAILED with value - {v}', f'WITH ERROR - {e.msg}')