Skip to content

Commit

Permalink
test(QueryList): Test objects (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Sep 17, 2022
1 parent 55acb21 commit 1efe871
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/_internal/test_query_list.py
@@ -1,16 +1,29 @@
import dataclasses
from typing import Any, Optional, Union

import pytest

from libvcs._internal.query_list import QueryList


@dataclasses.dataclass
class Obj:
test: int
fruit: list[str] = dataclasses.field(default_factory=list)


@pytest.mark.parametrize(
"items,filter_expr,expected_result",
[
[[Obj(test=1)], None, [Obj(test=1)]],
[[{"test": 1}], None, [{"test": 1}]],
[[{"test": 1}], None, QueryList([{"test": 1}])],
[[{"fruit": "apple"}], None, QueryList([{"fruit": "apple"}])],
[
[Obj(test=2, fruit=["apple"])],
None,
QueryList([Obj(test=2, fruit=["apple"])]),
],
[
[{"fruit": "apple", "banana": object()}],
None,
Expand Down

0 comments on commit 1efe871

Please sign in to comment.