-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add query checker tests for SPARQLModelAdapter
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
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,27 @@ | ||
"""Sad path tests for SPARQLModelAdapter with invalid queries""" | ||
|
||
import pytest | ||
|
||
from pydantic import BaseModel | ||
from rdfproxy.adapter import SPARQLModelAdapter | ||
from rdfproxy.utils._exceptions import QueryParseException, UnsupportedQueryException | ||
from tests.unit.tests_checkers.test_query_checker import ( | ||
fail_queries_parse_exception, | ||
fail_queries_unsupported, | ||
) | ||
|
||
|
||
class Dummy(BaseModel): | ||
pass | ||
|
||
|
||
@pytest.mark.parametrize("query", fail_queries_parse_exception) | ||
def test_adapter_parse_exception(query): | ||
with pytest.raises(QueryParseException): | ||
SPARQLModelAdapter(target="dummy.target", model=Dummy, query=query) | ||
|
||
|
||
@pytest.mark.parametrize("query", fail_queries_unsupported) | ||
def test_adapter_unsupported_exception(query): | ||
with pytest.raises(UnsupportedQueryException): | ||
SPARQLModelAdapter(target="dummy.target", model=Dummy, query=query) |