| Name | langchain-tests JSON |
| Version |
1.0.0
JSON |
| download |
| home_page | None |
| Summary | Standard tests for LangChain implementations |
| upload_time | 2025-10-17 13:56:00 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | <4.0.0,>=3.10.0 |
| license | MIT |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# 🦜️🔗 langchain-tests
[](https://pypi.org/project/langchain-tests/#history)
[](https://opensource.org/licenses/MIT)
[](https://pypistats.org/packages/langchain-tests)
[](https://twitter.com/langchainai)
Looking for the JS/TS version? Check out [LangChain.js](https://github.com/langchain-ai/langchainjs).
## Quick Install
```bash
pip install langchain-tests
```
## 🤔 What is this?
This is a testing library for LangChain integrations. It contains the base classes for a standard set of tests.
## 📖 Documentation
For full documentation, see the [API reference](https://reference.langchain.com/python/langchain).
## 📕 Releases & Versioning
See our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.
We encourage pinning your version to a specific version in order to avoid breaking your CI when we publish new tests. We recommend upgrading to the latest version periodically to make sure you have the latest tests.
Not pinning your version will ensure you always have the latest tests, but it may also break your CI if we introduce tests that your integration doesn't pass.
## 💁 Contributing
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
## Usage
To add standard tests to an integration package (e.g., for a chat model), you need to create
1. A unit test class that inherits from `ChatModelUnitTests`
2. An integration test class that inherits from `ChatModelIntegrationTests`
`tests/unit_tests/test_standard.py`:
```python
"""Standard LangChain interface tests"""
from typing import Type
import pytest
from langchain_core.language_models import BaseChatModel
from langchain_tests.unit_tests import ChatModelUnitTests
from langchain_parrot_chain import ChatParrotChain
class TestParrotChainStandard(ChatModelUnitTests):
@pytest.fixture
def chat_model_class(self) -> Type[BaseChatModel]:
return ChatParrotChain
```
`tests/integration_tests/test_standard.py`:
```python
"""Standard LangChain interface tests"""
from typing import Type
import pytest
from langchain_core.language_models import BaseChatModel
from langchain_tests.integration_tests import ChatModelIntegrationTests
from langchain_parrot_chain import ChatParrotChain
class TestParrotChainStandard(ChatModelIntegrationTests):
@pytest.fixture
def chat_model_class(self) -> Type[BaseChatModel]:
return ChatParrotChain
```
## Reference
The following fixtures are configurable in the test classes. Anything not marked
as required is optional.
- `chat_model_class` (required): The class of the chat model to be tested
- `chat_model_params`: The keyword arguments to pass to the chat model constructor
- `chat_model_has_tool_calling`: Whether the chat model can call tools. By default, this is set to `hasattr(chat_model_class, 'bind_tools)`
- `chat_model_has_structured_output`: Whether the chat model can structured output. By default, this is set to `hasattr(chat_model_class, 'with_structured_output')`
Raw data
{
"_id": null,
"home_page": null,
"name": "langchain-tests",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.10.0",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Erick Friis <erick@langchain.dev>",
"download_url": "https://files.pythonhosted.org/packages/2d/fb/7a16b5955be9744f8842b41526c9048692f1deb4de2ad98a1e03c5a41f5d/langchain_tests-1.0.0.tar.gz",
"platform": null,
"description": "# \ud83e\udd9c\ufe0f\ud83d\udd17 langchain-tests\n\n[](https://pypi.org/project/langchain-tests/#history)\n[](https://opensource.org/licenses/MIT)\n[](https://pypistats.org/packages/langchain-tests)\n[](https://twitter.com/langchainai)\n\nLooking for the JS/TS version? Check out [LangChain.js](https://github.com/langchain-ai/langchainjs).\n\n## Quick Install\n\n```bash\npip install langchain-tests\n```\n\n## \ud83e\udd14 What is this?\n\nThis is a testing library for LangChain integrations. It contains the base classes for a standard set of tests.\n\n## \ud83d\udcd6 Documentation\n\nFor full documentation, see the [API reference](https://reference.langchain.com/python/langchain).\n\n## \ud83d\udcd5 Releases & Versioning\n\nSee our [Releases](https://docs.langchain.com/oss/python/release-policy) and [Versioning](https://docs.langchain.com/oss/python/versioning) policies.\n\nWe encourage pinning your version to a specific version in order to avoid breaking your CI when we publish new tests. We recommend upgrading to the latest version periodically to make sure you have the latest tests.\n\nNot pinning your version will ensure you always have the latest tests, but it may also break your CI if we introduce tests that your integration doesn't pass.\n\n## \ud83d\udc81 Contributing\n\nAs an open-source project in a rapidly developing field, we are extremely open to contributions, whether it be in the form of a new feature, improved infrastructure, or better documentation.\n\nFor detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).\n\n## Usage\n\nTo add standard tests to an integration package (e.g., for a chat model), you need to create\n\n1. A unit test class that inherits from `ChatModelUnitTests`\n2. An integration test class that inherits from `ChatModelIntegrationTests`\n\n`tests/unit_tests/test_standard.py`:\n\n```python\n\"\"\"Standard LangChain interface tests\"\"\"\n\nfrom typing import Type\n\nimport pytest\nfrom langchain_core.language_models import BaseChatModel\nfrom langchain_tests.unit_tests import ChatModelUnitTests\n\nfrom langchain_parrot_chain import ChatParrotChain\n\n\nclass TestParrotChainStandard(ChatModelUnitTests):\n @pytest.fixture\n def chat_model_class(self) -> Type[BaseChatModel]:\n return ChatParrotChain\n```\n\n`tests/integration_tests/test_standard.py`:\n\n```python\n\"\"\"Standard LangChain interface tests\"\"\"\n\nfrom typing import Type\n\nimport pytest\nfrom langchain_core.language_models import BaseChatModel\nfrom langchain_tests.integration_tests import ChatModelIntegrationTests\n\nfrom langchain_parrot_chain import ChatParrotChain\n\n\nclass TestParrotChainStandard(ChatModelIntegrationTests):\n @pytest.fixture\n def chat_model_class(self) -> Type[BaseChatModel]:\n return ChatParrotChain\n```\n\n## Reference\n\nThe following fixtures are configurable in the test classes. Anything not marked\nas required is optional.\n\n- `chat_model_class` (required): The class of the chat model to be tested\n- `chat_model_params`: The keyword arguments to pass to the chat model constructor\n- `chat_model_has_tool_calling`: Whether the chat model can call tools. By default, this is set to `hasattr(chat_model_class, 'bind_tools)`\n- `chat_model_has_structured_output`: Whether the chat model can structured output. By default, this is set to `hasattr(chat_model_class, 'with_structured_output')`\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Standard tests for LangChain implementations",
"version": "1.0.0",
"project_urls": {
"changelog": "https://github.com/langchain-ai/langchain/releases?q=%22langchain-tests%3D%3D1%22",
"homepage": "https://docs.langchain.com/",
"reddit": "https://www.reddit.com/r/LangChain/",
"repository": "https://github.com/langchain-ai/langchain/tree/master/libs/standard-tests",
"slack": "https://www.langchain.com/join-community",
"twitter": "https://x.com/LangChainAI"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "711d055ca9d7d56f5ecb8f1f4a888879c92edd350520c14932559c285c00772f",
"md5": "e663376d343efaab24cecc5623ccc68a",
"sha256": "c3fdf290ce79d84382dda37cfb20ab56f7ccdd2d9c921f876b77bc3eb5e9f7fb"
},
"downloads": -1,
"filename": "langchain_tests-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e663376d343efaab24cecc5623ccc68a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.10.0",
"size": 49900,
"upload_time": "2025-10-17T13:55:59",
"upload_time_iso_8601": "2025-10-17T13:55:59.489779Z",
"url": "https://files.pythonhosted.org/packages/71/1d/055ca9d7d56f5ecb8f1f4a888879c92edd350520c14932559c285c00772f/langchain_tests-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2dfb7a16b5955be9744f8842b41526c9048692f1deb4de2ad98a1e03c5a41f5d",
"md5": "0d666112e562f30aabe54dcbfcab06a0",
"sha256": "f918bcccd84f9e7448fa382c0956b1ef1ddc87ac1083fa55b13f42c40fd3024c"
},
"downloads": -1,
"filename": "langchain_tests-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "0d666112e562f30aabe54dcbfcab06a0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.10.0",
"size": 155507,
"upload_time": "2025-10-17T13:56:00",
"upload_time_iso_8601": "2025-10-17T13:56:00.660916Z",
"url": "https://files.pythonhosted.org/packages/2d/fb/7a16b5955be9744f8842b41526c9048692f1deb4de2ad98a1e03c5a41f5d/langchain_tests-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-17 13:56:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "langchain-ai",
"github_project": "langchain",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "langchain-tests"
}