mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-20 14:42:28 +02:00
19 lines
328 B
Python
19 lines
328 B
Python
from typing import Iterator
|
|
|
|
from langgraph.pregel.io import single
|
|
|
|
|
|
def test_single() -> None:
|
|
closed = False
|
|
|
|
def myiter() -> Iterator[int]:
|
|
try:
|
|
yield 1
|
|
yield 2
|
|
finally:
|
|
nonlocal closed
|
|
closed = True
|
|
|
|
assert single(myiter()) == 1
|
|
assert closed
|