-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
21 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from typing import Optional | ||
|
||
import pytest | ||
|
||
from libvcs.query import ListQuery | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"items,filter_expr,expected_result", | ||
[ | ||
[[dict(apple="fruit")], None, ListQuery([dict(apple="fruit")])], | ||
[[1, 2, 3, 4, 5], None, ListQuery([1, 2, 3, 4, 5])], | ||
], | ||
) | ||
def test_ListQuery(items: list, filter_expr: Optional[dict], expected_result: list): | ||
qs = ListQuery(data=items) | ||
if filter_expr is not None: | ||
assert qs.filter(**filter_expr) == expected_result | ||
else: | ||
assert qs.filter() == expected_result |