Beispiel #1
0
def test_warn_if_valueNodeType_literal_used_with_any_value_shape():
    """@@@"""
    sc = TAPStatementTemplate()
    sc.propertyID = ":status"
    sc.valueNodeType = "literal"
    sc.valueShape = "Person"
    sc._valueDataType_warn_if_valueNodeType_literal_used_with_any_valueShape()
    assert len(sc.state_warns) == 1
Beispiel #2
0
def test_warn_if_valueConstraintType_pattern_used_with_any_value_shape():
    """Regular expressions cannot conform to value shapes."""
    sc = TAPStatementTemplate()
    sc.propertyID = ":status"
    sc.valueConstraintType = "pattern"
    sc.valueShape = "Person"
    sc._valueConstraintType_pattern_warn_if_used_with_value_shape()
    assert len(sc.state_warns) == 1
def test_list_elements_single_space_is_default():
    """Space is default list item separator."""
    sc = TAPStatementTemplate()
    sc.propertyID = "dcterms:creator dcterms:date"
    sc.valueNodeType = "iri bnode"
    sc.valueDataType = "xsd:date xsd:time"
    sc.valueShape = "a b c d"
    sc._parse_elements_configured_as_list_elements(config_dict)
    assert sc.propertyID == ["dcterms:creator", "dcterms:date"]
    assert sc.valueNodeType == ["iri", "bnode"]
    assert sc.valueDataType == ["xsd:date", "xsd:time"]
    assert sc.valueShape == ["a", "b", "c", "d"]
def test_list_elements():
    """Elements enumerated in config settings are parsed as lists."""
    config_dict["list_item_separator"] = " "
    sc = TAPStatementTemplate()
    sc.propertyID = "dcterms:creator dcterms:date"
    sc.valueNodeType = "iri bnode"
    sc.valueDataType = "xsd:date xsd:time"
    sc.valueShape = "a b c d"
    sc._parse_elements_configured_as_list_elements(config_dict)
    assert sc.propertyID == ["dcterms:creator", "dcterms:date"]
    assert sc.valueNodeType == ["iri", "bnode"]
    assert sc.valueDataType == ["xsd:date", "xsd:time"]
    assert sc.valueShape == ["a", "b", "c", "d"]