TestFormatterSingleton Class — langchain Architecture
Architecture documentation for the TestFormatterSingleton class in test_formatting.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 57618b7d_943a_63b5_3b0f_3de3e8bbbfc1["TestFormatterSingleton"] 29112ca2_d607_429e_5319_09bd1ea18686["StrictFormatter"] 57618b7d_943a_63b5_3b0f_3de3e8bbbfc1 -->|extends| 29112ca2_d607_429e_5319_09bd1ea18686 97ff01bf_b925_80dc_77c2_842f4aff378c["test_formatting.py"] 57618b7d_943a_63b5_3b0f_3de3e8bbbfc1 -->|defined in| 97ff01bf_b925_80dc_77c2_842f4aff378c ced2e287_a601_1213_f08d_c95e55c3c672["test_formatter_is_strict_formatter()"] 57618b7d_943a_63b5_3b0f_3de3e8bbbfc1 -->|method| ced2e287_a601_1213_f08d_c95e55c3c672 61f0dcf8_3193_2b68_3f1e_09ea48119ef6["test_formatter_format_works()"] 57618b7d_943a_63b5_3b0f_3de3e8bbbfc1 -->|method| 61f0dcf8_3193_2b68_3f1e_09ea48119ef6 6f3f3938_eaec_fafd_c40d_df9b3dfb7b7a["test_formatter_rejects_positional_args()"] 57618b7d_943a_63b5_3b0f_3de3e8bbbfc1 -->|method| 6f3f3938_eaec_fafd_c40d_df9b3dfb7b7a
Relationship Graph
Source Code
libs/core/tests/unit_tests/utils/test_formatting.py lines 112–127
class TestFormatterSingleton:
"""Tests for the formatter singleton instance."""
def test_formatter_is_strict_formatter(self) -> None:
"""Test that the formatter singleton is a `StrictFormatter` instance."""
assert isinstance(formatter, StrictFormatter)
def test_formatter_format_works(self) -> None:
"""Test that the formatter singleton can format strings."""
result = formatter.format("{greeting}, {name}!", greeting="Hello", name="World")
assert result == "Hello, World!"
def test_formatter_rejects_positional_args(self) -> None:
"""Test that the formatter singleton rejects positional arguments."""
with pytest.raises(ValueError, match=r"No arguments should be provided"):
formatter.format("{}", "arg")
Extends
Source
Frequently Asked Questions
What is the TestFormatterSingleton class?
TestFormatterSingleton is a class in the langchain codebase, defined in libs/core/tests/unit_tests/utils/test_formatting.py.
Where is TestFormatterSingleton defined?
TestFormatterSingleton is defined in libs/core/tests/unit_tests/utils/test_formatting.py at line 112.
What does TestFormatterSingleton extend?
TestFormatterSingleton extends StrictFormatter.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free