Home / Function/ test_partial_text_json_output_parser_with_json_code_block() — langchain Function Reference

test_partial_text_json_output_parser_with_json_code_block() — langchain Function Reference

Architecture documentation for the test_partial_text_json_output_parser_with_json_code_block() function in test_json.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6b239a88_48ec_3c3a_5e5d_d27b947c4ebd["test_partial_text_json_output_parser_with_json_code_block()"]
  8edb1db9_86b9_7cd9_158b_8b5423c9a6dd["test_json.py"]
  6b239a88_48ec_3c3a_5e5d_d27b947c4ebd -->|defined in| 8edb1db9_86b9_7cd9_158b_8b5423c9a6dd
  style 6b239a88_48ec_3c3a_5e5d_d27b947c4ebd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/output_parsers/test_json.py lines 587–603

def test_partial_text_json_output_parser_with_json_code_block() -> None:
    """Test json parser works correctly when the response contains a json code-block."""

    def input_iter(_: Any) -> Iterator[str]:
        yield from TOKENS_WITH_JSON_CODE_BLOCK

    chain = input_iter | SimpleJsonOutputParser()

    assert list(chain.stream(None)) == [
        {},
        {"country_name": ""},
        {"country_name": "France"},
        {"country_name": "France", "population_size": 67},
        {"country_name": "France", "population_size": 6739},
        {"country_name": "France", "population_size": 673915},
        {"country_name": "France", "population_size": 67391582},
    ]

Subdomains

Frequently Asked Questions

What does test_partial_text_json_output_parser_with_json_code_block() do?
test_partial_text_json_output_parser_with_json_code_block() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/output_parsers/test_json.py.
Where is test_partial_text_json_output_parser_with_json_code_block() defined?
test_partial_text_json_output_parser_with_json_code_block() is defined in libs/core/tests/unit_tests/output_parsers/test_json.py at line 587.

Analyze Your Own Codebase

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

Try Supermodel Free