コード例 #1
0
ファイル: test_context.py プロジェクト: edmondchuc/rdflib
def test_select_term_based_on_value_characteristics():
    ctx = Context()

    ctx.add_term("updated", "http://example.org/ns/updated")
    ctx.add_term(
        "updatedDate",
        "http://example.org/ns/updated",
        coercion="http://www.w3.org/2001/XMLSchema#date",
    )

    assert ctx.find_term("http://example.org/ns/updated").name == "updated"
    assert (ctx.find_term(
        "http://example.org/ns/updated",
        coercion="http://www.w3.org/2001/XMLSchema#date",
    ).name == "updatedDate")
コード例 #2
0
ファイル: test_context.py プロジェクト: edmondchuc/rdflib
def test_create_context():
    ctx = Context()
    ctx.add_term("label", "http://example.org/ns/label")
    term = ctx.terms.get("label")

    assert term.name == "label"
    assert ctx.find_term("http://example.org/ns/label") is term