Esempio n. 1
0
def test_statement_initialized_by_assignment_with_some_none():
    """Statement instance fields created by assignment, others have default None."""
    shap = Statement()
    shap.prop_id = "dcterms:creator"
    shap.value_type = "URI"
    assert shap == Statement(shape_id=None, prop_id="dcterms:creator", value_type="URI")
    assert not shap.shape_id
    assert not shap.mand
Esempio n. 2
0
def test_statement_initialized_by_assignment():
    """Statement instance fields created by assignment."""
    shap = Statement(shape_id="@photo", prop_id="dcterms:creator", value_type="URI")
    shap2 = Statement()
    shap2.shape_id = "@photo"
    shap2.prop_id = "dcterms:creator"
    shap2.value_type = "URI"
    assert shap == shap2
Esempio n. 3
0
def test_statement_bad_field_initialized_by_assignment():
    """Attempted assignment to bad field raises TypeError."""
    shap = Statement()
    shap.foobar = "@photo"
    shap.prop_id = "dcterms:creator"
    shap.value_type = "URI"
    with pytest.raises(TypeError):
        assert shap == Statement(
            foobar="@photo", prop_id="dcterms:creator", value_type="URI"
        )