Sequence type does not resolve
Dambre opened this issue · comments
Lukas commented
Sequence field does not resolve. After digging into internals it seems it does not collect it as valid type when checking for eligible objects. Reproduce simply:
class A(BaseModel):
x: Sequence[str]
pydantic2-resolve=2.1.1
tangkikodo commented
could you provide a more detailed test case? at my side
from pydantic import BaseModel
from pydantic_resolve import Resolver
from typing import Sequence
import pytest
class A(BaseModel):
y: Sequence[str]
x: Sequence[str] = []
def resolve_x(self):
return ['a', 'a']
@pytest.mark.asyncio
async def test_sequence():
a = A(y=['1'])
a = await Resolver().resolve(a)
assert a.x == ['a', 'a']
assert a.y == ['1']
this works.