-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #276 from RDFLib/lawson/predicate-validation
lawson/predicate validation
- Loading branch information
Showing
5 changed files
with
125 additions
and
70 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import pytest | ||
|
||
from prez.config import Settings | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"label_predicates, error", | ||
[ | ||
[["https://schema.org/name"], None], | ||
[["1", "2", "3"], None], | ||
[[1], TypeError], | ||
["not a list", ValueError], | ||
], | ||
) | ||
def test_label_predicates(label_predicates, error): | ||
if error: | ||
with pytest.raises(error): | ||
assert Settings(label_predicates=label_predicates) | ||
else: | ||
assert Settings(label_predicates=label_predicates) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"description_predicates, error", | ||
[ | ||
[["https://schema.org/description"], None], | ||
[["1", "2", "3"], None], | ||
[[1], TypeError], | ||
["not a list", ValueError], | ||
], | ||
) | ||
def test_description_predicates(description_predicates, error): | ||
if error: | ||
with pytest.raises(error): | ||
assert Settings(description_predicates=description_predicates) | ||
else: | ||
assert Settings(description_predicates=description_predicates) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"provenance_predicates, error", | ||
[ | ||
[["https://schema.org/provenance"], None], | ||
[["1", "2", "3"], None], | ||
[[1], TypeError], | ||
["not a list", ValueError], | ||
], | ||
) | ||
def test_provenance_predicates(provenance_predicates, error): | ||
if error: | ||
with pytest.raises(error): | ||
assert Settings(provenance_predicates=provenance_predicates) | ||
else: | ||
assert Settings(provenance_predicates=provenance_predicates) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"search_predicates, error", | ||
[ | ||
[["https://schema.org/search"], None], | ||
[["1", "2", "3"], None], | ||
[[1], TypeError], | ||
["not a list", ValueError], | ||
], | ||
) | ||
def test_search_predicates(search_predicates, error): | ||
if error: | ||
with pytest.raises(error): | ||
assert Settings(search_predicates=search_predicates) | ||
else: | ||
assert Settings(search_predicates=search_predicates) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"other_predicates, error", | ||
[ | ||
[["https://schema.org/other"], None], | ||
[["1", "2", "3"], None], | ||
[[1], TypeError], | ||
["not a list", ValueError], | ||
], | ||
) | ||
def test_other_predicates(other_predicates, error): | ||
if error: | ||
with pytest.raises(error): | ||
assert Settings(other_predicates=other_predicates) | ||
else: | ||
assert Settings(other_predicates=other_predicates) |