Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pydantic import BaseModel

from .backend import ModelPredicate, DictionaryTransform
from .expect import Expect
from .expect import ExpectBase

ModelT = TypeVar("ModelT", bound=dict | BaseModel)

Expand Down Expand Up @@ -49,9 +49,9 @@ def __init__(
) -> None:
self._items = list(items)

def expect(self) -> Expect:
def expect(self) -> ExpectBase[ModelT]:
"""Get an Expect instance for assertions on the current selection."""
return Expect(self._items)
return ExpectBase[ModelT](self._items)
Comment thread
rodrigobr-msft marked this conversation as resolved.

def _child(self, items: Sequence[ModelT]) -> Self:
"""Create a child Select with new items, inheriting selector and quantifier."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ def test_init_with_generator(self):
class TestSelectExpect:
"""Tests for the expect() method."""

def test_expect_returns_expect_instance(self):
"""expect() returns an Expect instance."""
select = Select([{"name": "a"}])
result = select.expect()
assert isinstance(result, Expect)

def test_expect_with_correct_items(self):
"""expect() passes the current items to Expect."""
items = [{"name": "a"}, {"name": "b"}]
Expand Down
Loading