Home / Function/ test_special_new_line_character() — anthropic-sdk-python Function Reference

test_special_new_line_character() — anthropic-sdk-python Function Reference

Architecture documentation for the test_special_new_line_character() function in test_streaming.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  522ee4f1_a04e_9a01_9a92_868b8b2dbf4a["test_special_new_line_character()"]
  2da79393_445f_321e_d12f_59a347c0de92["test_streaming.py"]
  522ee4f1_a04e_9a01_9a92_868b8b2dbf4a -->|defined in| 2da79393_445f_321e_d12f_59a347c0de92
  fbe4a363_44d9_e077_1c73_3ec8f52d326c["make_event_iterator()"]
  522ee4f1_a04e_9a01_9a92_868b8b2dbf4a -->|calls| fbe4a363_44d9_e077_1c73_3ec8f52d326c
  e0c910ce_14e1_57db_2c86_d0aaa328f673["iter_next()"]
  522ee4f1_a04e_9a01_9a92_868b8b2dbf4a -->|calls| e0c910ce_14e1_57db_2c86_d0aaa328f673
  c5af313f_3e52_e64c_55cd_3f91d2287e41["assert_empty_iter()"]
  522ee4f1_a04e_9a01_9a92_868b8b2dbf4a -->|calls| c5af313f_3e52_e64c_55cd_3f91d2287e41
  style 522ee4f1_a04e_9a01_9a92_868b8b2dbf4a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_streaming.py lines 166–193

async def test_special_new_line_character(
    sync: bool,
    client: Anthropic,
    async_client: AsyncAnthropic,
) -> None:
    def body() -> Iterator[bytes]:
        yield b'data: {"content":" culpa"}\n'
        yield b"\n"
        yield b'data: {"content":" \xe2\x80\xa8"}\n'
        yield b"\n"
        yield b'data: {"content":"foo"}\n'
        yield b"\n"

    iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client)

    sse = await iter_next(iterator)
    assert sse.event is None
    assert sse.json() == {"content": " culpa"}

    sse = await iter_next(iterator)
    assert sse.event is None
    assert sse.json() == {"content": " 
"}

    sse = await iter_next(iterator)
    assert sse.event is None
    assert sse.json() == {"content": "foo"}

    await assert_empty_iter(iterator)

Subdomains

Frequently Asked Questions

What does test_special_new_line_character() do?
test_special_new_line_character() is a function in the anthropic-sdk-python codebase, defined in tests/test_streaming.py.
Where is test_special_new_line_character() defined?
test_special_new_line_character() is defined in tests/test_streaming.py at line 166.
What does test_special_new_line_character() call?
test_special_new_line_character() calls 3 function(s): assert_empty_iter, iter_next, make_event_iterator.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free