repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_llm_utils.py | lib/crewai/tests/utilities/test_llm_utils.py | import os
from typing import Any
from unittest.mock import patch
from crewai.cli.constants import DEFAULT_LLM_MODEL
from crewai.llm import LLM
from crewai.llms.base_llm import BaseLLM
from crewai.utilities.llm_utils import create_llm
import pytest
def test_create_llm_with_llm_instance() -> None:
with patch.dict(... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_serialization.py | lib/crewai/tests/utilities/test_serialization.py | from datetime import date, datetime
from typing import List
import pytest
from crewai.utilities.serialization import to_serializable, to_string
from pydantic import BaseModel
class Address(BaseModel):
street: str
city: str
country: str
class Person(BaseModel):
name: str
age: int
address: Ad... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/test_events.py | lib/crewai/tests/utilities/test_events.py | import threading
from datetime import datetime
import os
from unittest.mock import Mock, patch
from crewai.agent import Agent
from crewai.agents.crew_agent_executor import CrewAgentExecutor
from crewai.crew import Crew
from crewai.events.event_bus import crewai_event_bus
from crewai.events.event_listener import EventL... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | true |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/crew/test_crew_context.py | lib/crewai/tests/utilities/crew/test_crew_context.py | import uuid
import pytest
from crewai.utilities.crew.crew_context import get_crew_context
from crewai.utilities.crew.models import CrewContext
from opentelemetry import baggage
from opentelemetry.context import attach, detach
def test_crew_context_creation():
crew_id = str(uuid.uuid4())
context = CrewContext... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/crew/__init__.py | lib/crewai/tests/utilities/crew/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/events/test_thread_safety.py | lib/crewai/tests/utilities/events/test_thread_safety.py | """Tests for thread safety in CrewAI event bus.
This module tests concurrent event emission and handler registration.
"""
import threading
import time
from collections.abc import Callable
from crewai.events.base_events import BaseEvent
from crewai.events.event_bus import crewai_event_bus
class ThreadSafetyTestEven... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/events/test_async_event_bus.py | lib/crewai/tests/utilities/events/test_async_event_bus.py | """Tests for async event handling in CrewAI event bus.
This module tests async handler registration, execution, and the aemit method.
"""
import asyncio
import pytest
from crewai.events.base_events import BaseEvent
from crewai.events.event_bus import crewai_event_bus
class AsyncTestEvent(BaseEvent):
pass
@p... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/events/test_rw_lock.py | lib/crewai/tests/utilities/events/test_rw_lock.py | """Tests for read-write lock implementation.
This module tests the RWLock class for correct concurrent read and write behavior.
"""
import threading
import time
from crewai.utilities.rw_lock import RWLock
def test_multiple_readers_concurrent():
lock = RWLock()
active_readers = [0]
max_concurrent_reader... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/events/test_crewai_event_bus.py | lib/crewai/tests/utilities/events/test_crewai_event_bus.py | import threading
from unittest.mock import Mock
from crewai.events.base_events import BaseEvent
from crewai.events.event_bus import crewai_event_bus
class TestEvent(BaseEvent):
pass
def test_specific_event_handler():
mock_handler = Mock()
condition = threading.Condition()
handler_called = [False]
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/events/test_shutdown.py | lib/crewai/tests/utilities/events/test_shutdown.py | """Tests for event bus shutdown and cleanup behavior.
This module tests graceful shutdown, task completion, and cleanup operations.
"""
import asyncio
import threading
import time
import pytest
from crewai.events.base_events import BaseEvent
from crewai.events.event_bus import CrewAIEventsBus
class ShutdownTestEv... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/events/__init__.py | lib/crewai/tests/utilities/events/__init__.py | """Tests for events."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/evaluators/test_crew_evaluator_handler.py | lib/crewai/tests/utilities/evaluators/test_crew_evaluator_handler.py | from unittest import mock
import pytest
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.task import Task
from crewai.tasks.task_output import TaskOutput
from crewai.utilities.evaluators.crew_evaluator_handler import (
CrewEvaluator,
TaskEvaluationPydanticOutput,
)
class InternalCrewEv... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/evaluators/test_task_evaluator.py | lib/crewai/tests/utilities/evaluators/test_task_evaluator.py | from unittest.mock import MagicMock, patch
from crewai.utilities.converter import ConverterError
from crewai.utilities.evaluators.task_evaluator import (
TaskEvaluator,
TrainingTaskEvaluation,
)
@patch("crewai.utilities.evaluators.task_evaluator.TrainingConverter")
def test_evaluate_training_data(converter_m... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/utilities/evaluators/__init__.py | lib/crewai/tests/utilities/evaluators/__init__.py | """Tests for evaluators."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/__init__.py | lib/crewai/tests/experimental/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/test_agent_evaluator.py | lib/crewai/tests/experimental/evaluation/test_agent_evaluator.py | import threading
import pytest
from crewai.agent import Agent
from crewai.crew import Crew
from crewai.events.event_bus import crewai_event_bus
from crewai.events.types.agent_events import (
AgentEvaluationCompletedEvent,
AgentEvaluationFailedEvent,
AgentEvaluationStartedEvent,
)
from crewai.experimental.e... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/test_experiment_result.py | lib/crewai/tests/experimental/evaluation/test_experiment_result.py | import pytest
from unittest.mock import MagicMock, patch
from crewai.experimental.evaluation.experiment.result import ExperimentResult, ExperimentResults
class TestExperimentResult:
@pytest.fixture
def mock_results(self):
return [
ExperimentResult(
identifier="test-1",
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/__init__.py | lib/crewai/tests/experimental/evaluation/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/test_experiment_runner.py | lib/crewai/tests/experimental/evaluation/test_experiment_runner.py | from unittest.mock import MagicMock, patch
import pytest
from crewai.crew import Crew
from crewai.experimental.evaluation.base_evaluator import (
EvaluationScore,
MetricCategory,
)
from crewai.experimental.evaluation.evaluation_display import (
AgentAggregatedEvaluationResult,
)
from crewai.experimental.ev... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/metrics/test_base_evaluation_metrics.py | lib/crewai/tests/experimental/evaluation/metrics/test_base_evaluation_metrics.py | from unittest.mock import MagicMock
import pytest
from crewai.agent import Agent
from crewai.task import Task
class BaseEvaluationMetricsTest:
@pytest.fixture
def mock_agent(self):
agent = MagicMock(spec=Agent)
agent.id = "test_agent_id"
agent.role = "Test Agent"
agent.goal = ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/metrics/test_goal_metrics.py | lib/crewai/tests/experimental/evaluation/metrics/test_goal_metrics.py | from unittest.mock import MagicMock, patch
from crewai.experimental.evaluation.base_evaluator import EvaluationScore
from crewai.experimental.evaluation.metrics.goal_metrics import GoalAlignmentEvaluator
from crewai.utilities.llm_utils import LLM
from tests.experimental.evaluation.metrics.test_base_evaluation_metrics... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/metrics/test_tools_metrics.py | lib/crewai/tests/experimental/evaluation/metrics/test_tools_metrics.py | from unittest.mock import MagicMock, patch
from crewai.experimental.evaluation.metrics.tools_metrics import (
ParameterExtractionEvaluator,
ToolInvocationEvaluator,
ToolSelectionEvaluator,
)
from crewai.utilities.llm_utils import LLM
from tests.experimental.evaluation.metrics.test_base_evaluation_metrics ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/metrics/__init__.py | lib/crewai/tests/experimental/evaluation/metrics/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/metrics/test_reasoning_metrics.py | lib/crewai/tests/experimental/evaluation/metrics/test_reasoning_metrics.py | from typing import Any, Dict, List
from unittest.mock import MagicMock, patch
import pytest
from crewai.experimental.evaluation.base_evaluator import EvaluationScore
from crewai.experimental.evaluation.metrics.reasoning_metrics import (
ReasoningEfficiencyEvaluator,
)
from crewai.tasks.task_output import TaskOutpu... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/experimental/evaluation/metrics/test_semantic_quality_metrics.py | lib/crewai/tests/experimental/evaluation/metrics/test_semantic_quality_metrics.py | from unittest.mock import patch, MagicMock
from crewai.experimental.evaluation.base_evaluator import EvaluationScore
from crewai.experimental.evaluation.metrics.semantic_quality_metrics import (
SemanticQualityEvaluator,
)
from tests.experimental.evaluation.metrics.test_base_evaluation_metrics import (
BaseEva... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_crew_test.py | lib/crewai/tests/cli/test_crew_test.py | import subprocess
from unittest import mock
import pytest
from crewai.cli import evaluate_crew
@pytest.mark.parametrize(
"n_iterations,model",
[
(1, "gpt-4o"),
(5, "gpt-3.5-turbo"),
(10, "gpt-4"),
],
)
@mock.patch("crewai.cli.evaluate_crew.subprocess.run")
def test_crew_success(m... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_plus_api.py | lib/crewai/tests/cli/test_plus_api.py | import os
import unittest
from unittest.mock import ANY, MagicMock, patch
from crewai.cli.plus_api import PlusAPI
class TestPlusAPI(unittest.TestCase):
def setUp(self):
self.api_key = "test_api_key"
self.api = PlusAPI(self.api_key)
self.org_uuid = "test-org-uuid"
def test_init(self):... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_train_crew.py | lib/crewai/tests/cli/test_train_crew.py | import subprocess
from unittest import mock
from crewai.cli.train_crew import train_crew
@mock.patch("crewai.cli.train_crew.subprocess.run")
def test_train_crew_positive_iterations(mock_subprocess_run):
n_iterations = 5
mock_subprocess_run.return_value = subprocess.CompletedProcess(
args=["uv", "run"... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_settings_command.py | lib/crewai/tests/cli/test_settings_command.py | import tempfile
import unittest
from pathlib import Path
from unittest.mock import patch, MagicMock, call
from crewai.cli.settings.main import SettingsCommand
from crewai.cli.config import (
Settings,
USER_SETTINGS_KEYS,
CLI_SETTINGS_KEYS,
DEFAULT_CLI_SETTINGS,
HIDDEN_SETTINGS_KEYS,
READONLY_SE... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_config.py | lib/crewai/tests/cli/test_config.py | import json
import shutil
import tempfile
import unittest
from datetime import datetime, timedelta
from pathlib import Path
from unittest.mock import MagicMock, patch
from crewai.cli.config import (
CLI_SETTINGS_KEYS,
DEFAULT_CLI_SETTINGS,
USER_SETTINGS_KEYS,
Settings,
)
from crewai.cli.shared.token_ma... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_utils.py | lib/crewai/tests/cli/test_utils.py | import os
import shutil
import tempfile
from pathlib import Path
import pytest
from crewai.cli import utils
@pytest.fixture
def temp_tree():
root_dir = tempfile.mkdtemp()
create_file(os.path.join(root_dir, "file1.txt"), "Hello, world!")
create_file(os.path.join(root_dir, "file2.txt"), "Another file")
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_constants.py | lib/crewai/tests/cli/test_constants.py | from crewai.cli.constants import ENV_VARS, MODELS, PROVIDERS
def test_huggingface_in_providers():
"""Test that Huggingface is in the PROVIDERS list."""
assert "huggingface" in PROVIDERS
def test_huggingface_env_vars():
"""Test that Huggingface environment variables are properly configured."""
assert... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_git.py | lib/crewai/tests/cli/test_git.py | import pytest
from crewai.cli.git import Repository
@pytest.fixture()
def repository(fp):
fp.register(["git", "--version"], stdout="git version 2.30.0\n")
fp.register(["git", "rev-parse", "--is-inside-work-tree"], stdout="true\n")
fp.register(["git", "fetch"], stdout="")
return Repository(path=".")
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_cli.py | lib/crewai/tests/cli/test_cli.py | from pathlib import Path
from unittest import mock
import pytest
from click.testing import CliRunner
from crewai.cli.cli import (
deploy_create,
deploy_list,
deploy_logs,
deploy_push,
deploy_remove,
deply_status,
flow_add_crew,
login,
reset_memories,
test,
train,
version... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_token_manager.py | lib/crewai/tests/cli/test_token_manager.py | """Tests for TokenManager with atomic file operations."""
import json
import os
import tempfile
import unittest
from datetime import datetime, timedelta
from pathlib import Path
from unittest.mock import patch
from cryptography.fernet import Fernet
from crewai.cli.shared.token_manager import TokenManager
class Tes... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_version.py | lib/crewai/tests/cli/test_version.py | """Test for version management."""
from crewai import __version__
from crewai.cli.version import get_crewai_version
def test_dynamic_versioning_consistency():
"""Test that dynamic versioning provides consistent version across all access methods."""
cli_version = get_crewai_version()
package_version = __v... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/__init__.py | lib/crewai/tests/cli/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/test_create_crew.py | lib/crewai/tests/cli/test_create_crew.py | import keyword
import shutil
import tempfile
from pathlib import Path
from unittest import mock
import pytest
from click.testing import CliRunner
from crewai.cli.create_crew import create_crew, create_folder_structure
@pytest.fixture
def runner():
return CliRunner()
@pytest.fixture
def temp_dir():
temp_pat... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/tools/test_main.py | lib/crewai/tests/cli/tools/test_main.py | import os
import tempfile
import unittest
import unittest.mock
from contextlib import contextmanager
from datetime import datetime, timedelta
from pathlib import Path
from unittest import mock
from unittest.mock import MagicMock, patch
import pytest
from crewai.cli.shared.token_manager import TokenManager
from crewai.... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/tools/__init__.py | lib/crewai/tests/cli/tools/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/organization/test_main.py | lib/crewai/tests/cli/organization/test_main.py | import unittest
from unittest.mock import MagicMock, patch, call
import pytest
from click.testing import CliRunner
import requests
from crewai.cli.organization.main import OrganizationCommand
from crewai.cli.cli import org_list, switch, current
@pytest.fixture
def runner():
return CliRunner()
@pytest.fixture
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/organization/__init__.py | lib/crewai/tests/cli/organization/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/deploy/__init__.py | lib/crewai/tests/cli/deploy/__init__.py | """Tests for CLI deploy."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/deploy/test_deploy_main.py | lib/crewai/tests/cli/deploy/test_deploy_main.py | import sys
import unittest
from io import StringIO
from unittest.mock import MagicMock, Mock, patch
import pytest
import requests
from crewai.cli.deploy.main import DeployCommand
from crewai.cli.utils import parse_toml
from requests.exceptions import JSONDecodeError
class TestDeployCommand(unittest.TestCase):
@p... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/authentication/test_utils.py | lib/crewai/tests/cli/authentication/test_utils.py | import unittest
from unittest.mock import MagicMock, patch
import jwt
from crewai.cli.authentication.utils import validate_jwt_token
@patch("crewai.cli.authentication.utils.PyJWKClient", return_value=MagicMock())
@patch("crewai.cli.authentication.utils.jwt")
class TestUtils(unittest.TestCase):
def test_validate... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/authentication/test_auth_main.py | lib/crewai/tests/cli/authentication/test_auth_main.py | from datetime import datetime, timedelta
from unittest.mock import MagicMock, call, patch
import pytest
import requests
from crewai.cli.authentication.main import AuthenticationCommand
from crewai.cli.constants import (
CREWAI_ENTERPRISE_DEFAULT_OAUTH2_AUDIENCE,
CREWAI_ENTERPRISE_DEFAULT_OAUTH2_CLIENT_ID,
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/authentication/__init__.py | lib/crewai/tests/cli/authentication/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/authentication/providers/test_okta.py | lib/crewai/tests/cli/authentication/providers/test_okta.py | import pytest
from crewai.cli.authentication.main import Oauth2Settings
from crewai.cli.authentication.providers.okta import OktaProvider
class TestOktaProvider:
@pytest.fixture(autouse=True)
def setup_method(self):
self.valid_settings = Oauth2Settings(
provider="okta",
domain... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/authentication/providers/test_workos.py | lib/crewai/tests/cli/authentication/providers/test_workos.py | import pytest
from crewai.cli.authentication.main import Oauth2Settings
from crewai.cli.authentication.providers.workos import WorkosProvider
class TestWorkosProvider:
@pytest.fixture(autouse=True)
def setup_method(self):
self.valid_settings = Oauth2Settings(
provider="workos",
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/authentication/providers/test_auth0.py | lib/crewai/tests/cli/authentication/providers/test_auth0.py | import pytest
from crewai.cli.authentication.main import Oauth2Settings
from crewai.cli.authentication.providers.auth0 import Auth0Provider
class TestAuth0Provider:
@pytest.fixture(autouse=True)
def setup_method(self):
self.valid_settings = Oauth2Settings(
provider="auth0",
d... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/authentication/providers/__init__.py | lib/crewai/tests/cli/authentication/providers/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/authentication/providers/test_entra_id.py | lib/crewai/tests/cli/authentication/providers/test_entra_id.py | import pytest
from crewai.cli.authentication.main import Oauth2Settings
from crewai.cli.authentication.providers.entra_id import EntraIdProvider
class TestEntraIdProvider:
@pytest.fixture(autouse=True)
def setup_method(self):
self.valid_settings = Oauth2Settings(
provider="entra_id",
... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/triggers/test_main.py | lib/crewai/tests/cli/triggers/test_main.py | import json
import subprocess
import unittest
from unittest.mock import Mock, patch
import requests
from crewai.cli.triggers.main import TriggersCommand
class TestTriggersCommand(unittest.TestCase):
@patch("crewai.cli.command.get_auth_token")
@patch("crewai.cli.command.PlusAPI")
def setUp(self, mock_plus... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/enterprise/test_main.py | lib/crewai/tests/cli/enterprise/test_main.py | import tempfile
import unittest
from pathlib import Path
from unittest.mock import Mock, patch
import requests
from requests.exceptions import JSONDecodeError
from crewai.cli.enterprise.main import EnterpriseConfigureCommand
from crewai.cli.settings.main import SettingsCommand
import shutil
class TestEnterpriseConf... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/cli/enterprise/__init__.py | lib/crewai/tests/cli/enterprise/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/task/test_async_task.py | lib/crewai/tests/task/test_async_task.py | """Tests for async task execution."""
import pytest
from unittest.mock import AsyncMock, MagicMock, patch
from crewai.agent import Agent
from crewai.task import Task
from crewai.tasks.task_output import TaskOutput
from crewai.tasks.output_format import OutputFormat
@pytest.fixture
def test_agent() -> Agent:
"""... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/telemetry/test_execution_span_assignment.py | lib/crewai/tests/telemetry/test_execution_span_assignment.py | """Test that crew execution span is properly assigned during kickoff."""
import os
import threading
import pytest
from crewai import Agent, Crew, Task
from crewai.events.event_bus import crewai_event_bus
from crewai.events.event_listener import EventListener
from crewai.telemetry import Telemetry
@pytest.fixture(a... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/telemetry/test_flow_crew_span_integration.py | lib/crewai/tests/telemetry/test_flow_crew_span_integration.py | """Test that crew execution spans work correctly when crews run inside flows.
Note: These tests use mocked LLM responses instead of VCR cassettes because
VCR's httpx async stubs have a known incompatibility with the OpenAI client
when running inside asyncio.run() (which Flow.kickoff() uses). The VCR
assertion `assert ... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/telemetry/test_telemetry_disable.py | lib/crewai/tests/telemetry/test_telemetry_disable.py | import os
from unittest.mock import MagicMock, patch
import pytest
from crewai.telemetry import Telemetry
@pytest.fixture(autouse=True)
def cleanup_telemetry():
"""Automatically clean up Telemetry singleton between tests."""
Telemetry._instance = None
yield
Telemetry._instance = None
@pytest.mark.t... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/telemetry/__init__.py | lib/crewai/tests/telemetry/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/telemetry/test_telemetry.py | lib/crewai/tests/telemetry/test_telemetry.py | import os
import threading
from unittest.mock import patch
import pytest
from crewai import Agent, Crew, Task
from crewai.telemetry import Telemetry
from opentelemetry import trace
@pytest.fixture(autouse=True)
def cleanup_telemetry():
Telemetry._instance = None
if hasattr(Telemetry, "_lock"):
Teleme... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/mcp/test_sse_transport.py | lib/crewai/tests/mcp/test_sse_transport.py | """Tests for SSE transport."""
import pytest
from crewai.mcp.transports.sse import SSETransport
@pytest.mark.asyncio
async def test_sse_transport_connect_does_not_pass_invalid_args():
"""Test that SSETransport.connect() doesn't pass invalid args to sse_client.
The sse_client function does not accept termin... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/mcp/__init__.py | lib/crewai/tests/mcp/__init__.py | """Tests for MCP (Model Context Protocol) integration."""
| python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/mcp/test_mcp_config.py | lib/crewai/tests/mcp/test_mcp_config.py | import asyncio
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from crewai.agent.core import Agent
from crewai.mcp.config import MCPServerHTTP, MCPServerSSE, MCPServerStdio
from crewai.tools.base_tool import BaseTool
@pytest.fixture
def mock_tool_definitions():
"""Create mock MCP tool definit... | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI/blob/f3c17a249b5a2da3a917784d9762421591c1cde5/lib/crewai/tests/pipeline/__init__.py | lib/crewai/tests/pipeline/__init__.py | python | MIT | f3c17a249b5a2da3a917784d9762421591c1cde5 | 2026-01-04T14:39:52.484392Z | false | |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/.github/scripts/get_min_versions.py | .github/scripts/get_min_versions.py | """Get minimum versions of dependencies from a pyproject.toml file."""
import sys
from collections import defaultdict
if sys.version_info >= (3, 11):
import tomllib
else:
# For Python 3.10 and below, which doesnt have stdlib tomllib
import tomli as tomllib
import re
from typing import List
import reques... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/.github/scripts/check_prerelease_dependencies.py | .github/scripts/check_prerelease_dependencies.py | """Check that no dependencies allow prereleases unless we're releasing a prerelease."""
import sys
import tomllib
if __name__ == "__main__":
# Get the TOML file path from the command line argument
toml_file = sys.argv[1]
with open(toml_file, "rb") as file:
toml_data = tomllib.load(file)
# S... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/.github/scripts/check_diff.py | .github/scripts/check_diff.py | """Analyze git diffs to determine which directories need to be tested.
Intelligently determines which LangChain packages and directories need to be tested,
linted, or built based on the changes. Handles dependency relationships between
packages, maps file changes to appropriate CI job configurations, and outputs JSON
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/scripts/check_imports.py | libs/standard-tests/scripts/check_imports.py | """Check imports script."""
import secrets
import string
import sys
import traceback
from importlib.machinery import SourceFileLoader
if __name__ == "__main__":
files = sys.argv[1:]
has_failure = False
for file in files:
try:
module_name = "".join(
secrets.choice(string... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/test_basic_retriever.py | libs/standard-tests/tests/unit_tests/test_basic_retriever.py | from typing import Any
from langchain_core.documents import Document
from langchain_core.retrievers import BaseRetriever
from langchain_tests.integration_tests import RetrieversIntegrationTests
class ParrotRetriever(BaseRetriever):
parrot_name: str
k: int = 3
def _get_relevant_documents(self, query: st... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/test_in_memory_vectorstore.py | libs/standard-tests/tests/unit_tests/test_in_memory_vectorstore.py | from __future__ import annotations
import pytest
from langchain_core.vectorstores import (
InMemoryVectorStore,
VectorStore,
)
from langchain_tests.integration_tests.vectorstores import VectorStoreIntegrationTests
class TestInMemoryVectorStore(VectorStoreIntegrationTests):
@pytest.fixture
def vector... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/test_decorated_tool.py | libs/standard-tests/tests/unit_tests/test_decorated_tool.py | from typing import Any
from langchain_core.tools import BaseTool, tool
from langchain_tests.integration_tests import ToolsIntegrationTests
from langchain_tests.unit_tests import ToolsUnitTests
@tool
def parrot_multiply_tool(a: int, b: int) -> int:
"""Multiply two numbers like a parrot. Parrots always add eighty... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/custom_chat_model.py | libs/standard-tests/tests/unit_tests/custom_chat_model.py | from __future__ import annotations
from typing import TYPE_CHECKING, Any
from langchain_core.language_models import BaseChatModel
from langchain_core.messages import AIMessage, AIMessageChunk, BaseMessage
from langchain_core.messages.ai import UsageMetadata
from langchain_core.outputs import ChatGeneration, ChatGener... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/test_basic_tool.py | libs/standard-tests/tests/unit_tests/test_basic_tool.py | from typing import Any, Literal
from langchain_core.tools import BaseTool
from typing_extensions import override
from langchain_tests.integration_tests import ToolsIntegrationTests
from langchain_tests.unit_tests import ToolsUnitTests
class ParrotMultiplyTool(BaseTool):
name: str = "ParrotMultiplyTool"
desc... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/test_in_memory_cache.py | libs/standard-tests/tests/unit_tests/test_in_memory_cache.py | import pytest
from langchain_core.caches import InMemoryCache
from typing_extensions import override
from langchain_tests.integration_tests.cache import (
AsyncCacheTestSuite,
SyncCacheTestSuite,
)
class TestInMemoryCache(SyncCacheTestSuite):
@pytest.fixture
@override
def cache(self) -> InMemoryC... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/test_in_memory_base_store.py | libs/standard-tests/tests/unit_tests/test_in_memory_base_store.py | """Tests for the InMemoryStore class."""
import pytest
from langchain_core.stores import InMemoryStore
from typing_extensions import override
from langchain_tests.integration_tests.base_store import (
BaseStoreAsyncTests,
BaseStoreSyncTests,
)
class TestInMemoryStore(BaseStoreSyncTests[str]):
@pytest.fi... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/__init__.py | libs/standard-tests/tests/unit_tests/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false | |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/test_custom_chat_model.py | libs/standard-tests/tests/unit_tests/test_custom_chat_model.py | """Test the standard tests on the custom chat model in the docs."""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import pytest
from langchain_tests.integration_tests import ChatModelIntegrationTests
from langchain_tests.unit_tests import ChatModelUnitTests
from .custom_chat_model import... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/unit_tests/test_embeddings.py | libs/standard-tests/tests/unit_tests/test_embeddings.py | from typing import Any
from langchain_core.embeddings import DeterministicFakeEmbedding, Embeddings
from langchain_tests.integration_tests import EmbeddingsIntegrationTests
from langchain_tests.unit_tests import EmbeddingsUnitTests
class TestFakeEmbeddingsUnit(EmbeddingsUnitTests):
@property
def embeddings_... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/integration_tests/test_compile.py | libs/standard-tests/tests/integration_tests/test_compile.py | import pytest
@pytest.mark.compile
def test_placeholder() -> None:
"""Used for compiling integration tests without running any real tests."""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/tests/integration_tests/__init__.py | libs/standard-tests/tests/integration_tests/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false | |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/conftest.py | libs/standard-tests/langchain_tests/conftest.py | """Pytest conftest."""
from __future__ import annotations
import gzip
from pathlib import Path
from typing import TYPE_CHECKING, Any, cast
import pytest
import yaml
from langchain_core._api.deprecation import deprecated
from vcr import VCR
from vcr.persisters.filesystem import CassetteNotFoundError
from vcr.request ... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/__init__.py | libs/standard-tests/langchain_tests/__init__.py | """Base test classes for standard testing.
To learn how to use these, see the guide on
[integrating standard tests](https://docs.langchain.com/oss/python/contributing/standard-tests-langchain).
"""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/base.py | libs/standard-tests/langchain_tests/base.py | """Standard tests."""
class BaseStandardTests:
"""Base class for standard tests."""
def test_no_overrides_DO_NOT_OVERRIDE(self) -> None: # noqa: N802
"""Test that no standard tests are overridden."""
# Find path to standard test implementations
comparison_class = None
def ex... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/unit_tests/chat_models.py | libs/standard-tests/langchain_tests/unit_tests/chat_models.py | """Chat model unit tests."""
from __future__ import annotations
import inspect
import os
from abc import abstractmethod
from typing import TYPE_CHECKING, Any, Literal
from unittest import mock
import pytest
from langchain_core.language_models import BaseChatModel
from langchain_core.load import dumpd, load
from lang... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | true |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/unit_tests/tools.py | libs/standard-tests/langchain_tests/unit_tests/tools.py | """Tools unit tests."""
from __future__ import annotations
import os
from abc import abstractmethod
from typing import Any
from unittest import mock
import pytest
from langchain_core.tools import BaseTool
from pydantic import SecretStr
from langchain_tests.base import BaseStandardTests
class ToolsTests(BaseStanda... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/unit_tests/__init__.py | libs/standard-tests/langchain_tests/unit_tests/__init__.py | """Unit tests for LangChain components."""
# ruff: noqa: E402
import pytest
# Rewrite assert statements for test suite so that implementations can
# see the full error message from failed asserts.
# https://docs.pytest.org/en/7.1.x/how-to/writing_plugins.html#assertion-rewriting
modules = [
"chat_models",
"em... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/unit_tests/embeddings.py | libs/standard-tests/langchain_tests/unit_tests/embeddings.py | """Embeddings unit tests."""
import os
from abc import abstractmethod
from typing import Any
from unittest import mock
import pytest
from langchain_core.embeddings import Embeddings
from pydantic import SecretStr
from langchain_tests.base import BaseStandardTests
class EmbeddingsTests(BaseStandardTests):
"""Em... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/integration_tests/indexer.py | libs/standard-tests/langchain_tests/integration_tests/indexer.py | """Test suite to check index implementations.
Standard tests for the `DocumentIndex` abstraction
We don't recommend implementing externally managed `DocumentIndex` abstractions at this
time.
"""
import inspect
import uuid
from abc import ABC, abstractmethod
from collections.abc import AsyncGenerator, Generator
impo... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/integration_tests/base_store.py | libs/standard-tests/langchain_tests/integration_tests/base_store.py | """Standard tests for the `BaseStore` abstraction.
We don't recommend implementing externally managed `BaseStore` abstractions at this
time.
"""
from abc import abstractmethod
from collections.abc import AsyncGenerator, Generator
from typing import Generic, TypeVar
import pytest
from langchain_core.stores import Bas... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/integration_tests/chat_models.py | libs/standard-tests/langchain_tests/integration_tests/chat_models.py | """Integration tests for chat models."""
from __future__ import annotations
import base64
import json
import os
import warnings
from typing import TYPE_CHECKING, Annotated, Any, Literal
from unittest.mock import MagicMock
import httpx
import pytest
from langchain_core.callbacks import BaseCallbackHandler
from langch... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | true |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/integration_tests/tools.py | libs/standard-tests/langchain_tests/integration_tests/tools.py | """Integration tests for tools."""
from langchain_core.messages import ToolCall
from langchain_core.tools import BaseTool
from langchain_tests.unit_tests.tools import ToolsTests
class ToolsIntegrationTests(ToolsTests):
"""Base class for tools integration tests."""
def test_invoke_matches_output_schema(self... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/integration_tests/vectorstores.py | libs/standard-tests/langchain_tests/integration_tests/vectorstores.py | """Test suite to test `VectorStore` integrations."""
from abc import abstractmethod
import pytest
from langchain_core.documents import Document
from langchain_core.embeddings import DeterministicFakeEmbedding, Embeddings
from langchain_core.vectorstores import VectorStore
from langchain_tests.base import BaseStandar... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/integration_tests/retrievers.py | libs/standard-tests/langchain_tests/integration_tests/retrievers.py | """Integration tests for retrievers."""
from abc import abstractmethod
from typing import Any
import pytest
from langchain_core.documents import Document
from langchain_core.retrievers import BaseRetriever
from langchain_tests.base import BaseStandardTests
class RetrieversIntegrationTests(BaseStandardTests):
"... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/integration_tests/__init__.py | libs/standard-tests/langchain_tests/integration_tests/__init__.py | """Integration tests for LangChain components."""
# ruff: noqa: E402
import pytest
# Rewrite assert statements for test suite so that implementations can
# see the full error message from failed asserts.
# https://docs.pytest.org/en/7.1.x/how-to/writing_plugins.html#assertion-rewriting
modules = [
"base_store",
... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/integration_tests/embeddings.py | libs/standard-tests/langchain_tests/integration_tests/embeddings.py | """Integration tests for embeddings."""
from langchain_core.embeddings import Embeddings
from langchain_tests.unit_tests.embeddings import EmbeddingsTests
class EmbeddingsIntegrationTests(EmbeddingsTests):
"""Base class for embeddings integration tests.
Test subclasses must implement the `embeddings_class`... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/integration_tests/cache.py | libs/standard-tests/langchain_tests/integration_tests/cache.py | """Standard tests for the `BaseCache` abstraction.
We don't recommend implementing externally managed `BaseCache` abstractions at this
time.
"""
from abc import abstractmethod
import pytest
from langchain_core.caches import BaseCache
from langchain_core.outputs import Generation
from langchain_tests.base import Bas... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/utils/__init__.py | libs/standard-tests/langchain_tests/utils/__init__.py | """Langchain tests utilities."""
| python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/standard-tests/langchain_tests/utils/pydantic.py | libs/standard-tests/langchain_tests/utils/pydantic.py | """Utilities for working with pydantic models."""
def get_pydantic_major_version() -> int:
"""Get the major version of Pydantic."""
try:
import pydantic # noqa: PLC0415
return int(pydantic.__version__.split(".")[0])
except ImportError:
return 0
PYDANTIC_MAJOR_VERSION = get_pyda... | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
langchain-ai/langchain | https://github.com/langchain-ai/langchain/blob/e5d4acf681784d1ea356c932cf31c1c9723dbafa/libs/model-profiles/tests/__init__.py | libs/model-profiles/tests/__init__.py | python | MIT | e5d4acf681784d1ea356c932cf31c1c9723dbafa | 2026-01-04T14:38:15.444279Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.