def test_parsing_a_context_expands_prefixes(): ctx = Context({ "@vocab": "http://example.org/ns/", "x": "http://example.org/ns/", "label": "x:label", "x:updated": { "@type": "x:date" }, }) term = ctx.terms.get("label") assert term.id == "http://example.org/ns/label" term = ctx.terms.get("x:updated") assert term.id == "http://example.org/ns/updated" assert term.type == "http://example.org/ns/date" # test_expanding_terms(): assert ctx.expand("term") == "http://example.org/ns/term" assert ctx.expand("x:term") == "http://example.org/ns/term" # test_shrinking_iris(): assert ctx.shrink_iri("http://example.org/ns/term") == "x:term" assert ctx.to_symbol("http://example.org/ns/term") == "term"
def test_parsing_a_context_expands_prefixes(): ctx = Context({ '@vocab': 'http://example.org/ns/', 'x': 'http://example.org/ns/', 'label': 'x:label', 'x:updated': { '@type': 'x:date' } }) term = ctx.terms.get('label') assert term.id == 'http://example.org/ns/label' term = ctx.terms.get('x:updated') assert term.id == 'http://example.org/ns/updated' assert term.type == 'http://example.org/ns/date' # test_expanding_terms(): assert ctx.expand('term') == 'http://example.org/ns/term' assert ctx.expand('x:term') == 'http://example.org/ns/term' # test_shrinking_iris(): assert ctx.shrink_iri('http://example.org/ns/term') == 'x:term' assert ctx.to_symbol('http://example.org/ns/term') == 'term'
def test_parsing_a_context_expands_prefixes(): ctx = Context({ '@vocab': 'http://example.org/ns/', 'x': 'http://example.org/ns/', 'label': 'x:label', 'x:updated': {'@type': 'x:date'}}) term = ctx.terms.get('label') assert term.id == 'http://example.org/ns/label' term = ctx.terms.get('x:updated') assert term.id == 'http://example.org/ns/updated' assert term.type == 'http://example.org/ns/date' # test_expanding_terms(): assert ctx.expand('term') == 'http://example.org/ns/term' assert ctx.expand('x:term') == 'http://example.org/ns/term' # test_shrinking_iris(): assert ctx.shrink_iri('http://example.org/ns/term') == 'x:term' assert ctx.to_symbol('http://example.org/ns/term') == 'term'