Exemplo n.º 1
0
 def check_types(s: SchemaDefinition) -> None:
     self.assertEqual({
         'integer': {'base': 'int',
                     'from_schema': 'http://example.org/schema5',
                     'name': 'integer'},
         'string': {'base': 'str',
                    'from_schema': 'http://example.org/schema4',
                    'name': 'string'}},
                      {k: as_dict(loads(as_json(v))) for k, v in s.types.items()})
     s.types = None
Exemplo n.º 2
0
        def check_types(s: SchemaDefinition) -> None:
            output = os.path.join(outputdir, 'schema4.json')
            if not os.path.exists(output):
                with open(output, 'w') as f:
                    f.write(as_json(JsonObj(**{k: as_dict(loads(as_json(v))) for k, v in s.types.items()})))
                    self.fail(f"File {output} created - rerun test")

            with open(output) as f:
                expected = as_dict(load(f))
            self.assertEqual(expected, {k: as_dict(loads(as_json(v))) for k, v in s.types.items()})
            s.types = None