-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add custom tsquery from websearch function and related tests (#838)
* Add custom tsquery from websearch function and related tests * update tests and logic * fix style issues --------- Co-authored-by: James Kent <[email protected]>
- Loading branch information
Showing
5 changed files
with
292 additions
and
2 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
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,23 @@ | ||
import pytest | ||
|
||
from ..resources.utils import pubmed_to_tsquery, validate_search_query | ||
from .conftest import valid_queries, validate_queries, weird_queries | ||
|
||
|
||
@pytest.mark.parametrize("query, expected", valid_queries) | ||
def test_pubmed_to_tsquery(query, expected): | ||
assert pubmed_to_tsquery(query) == expected | ||
|
||
|
||
@pytest.mark.parametrize("query, expected", validate_queries) | ||
def test_validate_search_query(query, expected): | ||
if expected is True: | ||
assert validate_search_query(query) == expected | ||
else: | ||
with pytest.raises(Exception): | ||
validate_search_query(query) | ||
|
||
|
||
@pytest.mark.parametrize("query, expected", weird_queries) | ||
def test_pubmed_to_tsquery_weird(query, expected): | ||
assert pubmed_to_tsquery(query) == expected |