MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / test_iterable_of_dictionaries

Function test_iterable_of_dictionaries

tests/test_transform.py:374–388  ·  view source on GitHub ↗
(use_async: bool)

Source from the content-addressed store, hash-verified

372@parametrize
373@pytest.mark.asyncio
374async def test_iterable_of_dictionaries(use_async: bool) -> None:
375 assert await transform({"foo": [{"foo_baz": "bar"}]}, TypedDictIterableUnion, use_async) == {
376 "FOO": [{"fooBaz": "bar"}]
377 }
378 assert cast(Any, await transform({"foo": ({"foo_baz": "bar"},)}, TypedDictIterableUnion, use_async)) == {
379 "FOO": [{"fooBaz": "bar"}]
380 }
381
382 def my_iter() -> Iterable[Baz8]:
383 yield {"foo_baz": "hello"}
384 yield {"foo_baz": "world"}
385
386 assert await transform({"foo": my_iter()}, TypedDictIterableUnion, use_async) == {
387 "FOO": [{"fooBaz": "hello"}, {"fooBaz": "world"}]
388 }
389
390
391class TypedDictIterableUnionStr(TypedDict):

Callers

nothing calls this directly

Calls 2

my_iterFunction · 0.85
transformFunction · 0.70

Tested by

no test coverage detected