Skip to content

Commit

Permalink
!squash more
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Apr 16, 2022
1 parent 5c20116 commit 95ddbd6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
18 changes: 1 addition & 17 deletions tests/projects/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import pathlib
import textwrap
from typing import Callable, Optional
from typing import Callable

import pytest

Expand All @@ -17,7 +17,6 @@
GitProject,
GitRemote,
GitStatus,
ListQuery,
convert_pip_url as git_convert_pip_url,
)
from libvcs.shortcuts import create_project_from_pip_url
Expand Down Expand Up @@ -748,18 +747,3 @@ def test_repo_git_remote_checkout(

assert git_repo_checkout_dir.exists()
assert pathlib.Path(git_repo_checkout_dir / ".git").exists()


@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
20 changes: 20 additions & 0 deletions tests/test_query.py
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

0 comments on commit 95ddbd6

Please sign in to comment.