test_cli.py — langchain Source File
Architecture documentation for test_cli.py, a python file in the langchain codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 6d217c05_9e9a_cf3b_49be_7f86aef51607["test_cli.py"] 01d44b95_02da_6b59_b6ed_842bc82dfa56["importlib.util"] 6d217c05_9e9a_cf3b_49be_7f86aef51607 --> 01d44b95_02da_6b59_b6ed_842bc82dfa56 b6ee5de5_719a_eeb5_1e11_e9c63bc22ef8["pathlib"] 6d217c05_9e9a_cf3b_49be_7f86aef51607 --> b6ee5de5_719a_eeb5_1e11_e9c63bc22ef8 525a7d6f_f455_56e3_854a_c8a7da4a1417["unittest.mock"] 6d217c05_9e9a_cf3b_49be_7f86aef51607 --> 525a7d6f_f455_56e3_854a_c8a7da4a1417 120e2591_3e15_b895_72b6_cb26195e40a6["pytest"] 6d217c05_9e9a_cf3b_49be_7f86aef51607 --> 120e2591_3e15_b895_72b6_cb26195e40a6 e811feb6_0bc2_9658_a44f_72398631089a["langchain_model_profiles.cli"] 6d217c05_9e9a_cf3b_49be_7f86aef51607 --> e811feb6_0bc2_9658_a44f_72398631089a style 6d217c05_9e9a_cf3b_49be_7f86aef51607 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Tests for CLI functionality."""
import importlib.util
from pathlib import Path
from unittest.mock import Mock, patch
import pytest
from langchain_model_profiles.cli import _model_data_to_profile, refresh
@pytest.fixture
def mock_models_dev_response() -> dict:
"""Create a mock response from models.dev API."""
return {
"anthropic": {
"id": "anthropic",
"name": "Anthropic",
"models": {
"claude-3-opus": {
"id": "claude-3-opus",
"name": "Claude 3 Opus",
"tool_call": True,
"limit": {"context": 200000, "output": 4096},
"modalities": {"input": ["text", "image"], "output": ["text"]},
},
"claude-3-sonnet": {
"id": "claude-3-sonnet",
"name": "Claude 3 Sonnet",
"tool_call": True,
"limit": {"context": 200000, "output": 4096},
"modalities": {"input": ["text", "image"], "output": ["text"]},
},
},
},
"openai": {
"id": "openai",
"name": "OpenAI",
"models": {
"gpt-4": {
"id": "gpt-4",
"name": "GPT-4",
"tool_call": True,
"limit": {"context": 8192, "output": 4096},
"modalities": {"input": ["text"], "output": ["text"]},
}
},
},
}
def test_refresh_generates_profiles_file(
tmp_path: Path, mock_models_dev_response: dict
) -> None:
"""Test that refresh command generates _profiles.py with merged data."""
data_dir = tmp_path / "data"
data_dir.mkdir()
# Create augmentations file
aug_file = data_dir / "profile_augmentations.toml"
// ... (187 more lines)
Domain
Subdomains
Functions
- mock_models_dev_response()
- test_model_data_to_profile_text_modalities()
- test_refresh_aborts_when_user_declines_external_directory()
- test_refresh_generates_profiles_file()
- test_refresh_includes_models_defined_only_in_augmentations()
- test_refresh_raises_error_for_missing_provider()
- test_refresh_works_without_augmentations()
Dependencies
- importlib.util
- langchain_model_profiles.cli
- pathlib
- pytest
- unittest.mock
Source
Frequently Asked Questions
What does test_cli.py do?
test_cli.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_cli.py?
test_cli.py defines 7 function(s): mock_models_dev_response, test_model_data_to_profile_text_modalities, test_refresh_aborts_when_user_declines_external_directory, test_refresh_generates_profiles_file, test_refresh_includes_models_defined_only_in_augmentations, test_refresh_raises_error_for_missing_provider, test_refresh_works_without_augmentations.
What does test_cli.py depend on?
test_cli.py imports 5 module(s): importlib.util, langchain_model_profiles.cli, pathlib, pytest, unittest.mock.
Where is test_cli.py in the architecture?
test_cli.py is located at libs/model-profiles/tests/unit_tests/test_cli.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/model-profiles/tests/unit_tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free