test_regex.py — langchain Source File
Architecture documentation for test_regex.py, a python file in the langchain codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 22b2c8c4_6f3f_b43d_2fa2_bbc070a7237a["test_regex.py"] e7ae90d2_7c36_40aa_f905_386f8e995321["langchain_classic.output_parsers.regex"] 22b2c8c4_6f3f_b43d_2fa2_bbc070a7237a --> e7ae90d2_7c36_40aa_f905_386f8e995321 style 22b2c8c4_6f3f_b43d_2fa2_bbc070a7237a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from langchain_classic.output_parsers.regex import RegexParser
# NOTE: The almost same constant variables in ./test_combining_parser.py
DEF_EXPECTED_RESULT = {
"confidence": "A",
"explanation": "Paris is the capital of France according to Wikipedia.",
}
DEF_README = """```json
{
"answer": "Paris",
"source": "https://en.wikipedia.org/wiki/France"
}
```
//Confidence: A, Explanation: Paris is the capital of France according to Wikipedia."""
def test_regex_parser_parse() -> None:
"""Test regex parser parse."""
parser = RegexParser(
regex=r"Confidence: (A|B|C), Explanation: (.*)",
output_keys=["confidence", "explanation"],
default_output_key="noConfidence",
)
assert parser.parse(DEF_README) == DEF_EXPECTED_RESULT
def test_regex_parser_output_type() -> None:
"""Test regex parser output type is Dict[str, str]."""
parser = RegexParser(
regex=r"Confidence: (A|B|C), Explanation: (.*)",
output_keys=["confidence", "explanation"],
default_output_key="noConfidence",
)
assert parser.OutputType == dict[str, str]
Domain
Subdomains
Dependencies
- langchain_classic.output_parsers.regex
Source
Frequently Asked Questions
What does test_regex.py do?
test_regex.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in test_regex.py?
test_regex.py defines 2 function(s): test_regex_parser_output_type, test_regex_parser_parse.
What does test_regex.py depend on?
test_regex.py imports 1 module(s): langchain_classic.output_parsers.regex.
Where is test_regex.py in the architecture?
test_regex.py is located at libs/langchain/tests/unit_tests/output_parsers/test_regex.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/langchain/tests/unit_tests/output_parsers).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free