def test_parse_iri_misinterpretation(self): from libadvene.model.parsers.cinelab_json import Parser as JsonParser json= { "format": "http://advene.org/ns/cinelab/", "@context": { "dc": "http://purl.org/dc/elements/1.1/" }, "meta": { "creator": "pa", "created": "2014-09-28T21:03:02.795939" }, "annotation_types": [ { "id": "at", }, ], "medias": [ { "id": "m", "url": "foo.mp4", }, ], "annotations": [ { "id": "a1", "begin": 12, "end": 34, "media": "m", "content": { "mimetype": "application/x-ldt-structured", "foo": "bar", "toto": "tata" }, "meta": { "id-ref": "at", }, } ] } p = CamPackage("http://localhost:1234/test.json", create=True) JsonParser.parse_into(json, p) assert p["a1"].type == p["at"] assert "foo" in p["a1"].content_parsed
def test_parse_json_directly(self): from libadvene.model.parsers.cinelab_json import Parser as JsonParser p = CamPackage("http://localhost:1234/test.json", create=True) JsonParser.parse_into({}, p)