# EmbeddingsUnitTests

> **Class** in `langchain_tests`

📖 [View in docs](https://reference.langchain.com/python/langchain-tests/unit_tests/embeddings/EmbeddingsUnitTests)

Base class for embeddings unit tests.

Test subclasses must implement the `embeddings_class` property to specify the
embeddings model to be tested. You can also override the
`embedding_model_params` property to specify initialization parameters.

```python
from typing import Type

from langchain_tests.unit_tests import EmbeddingsUnitTests
from my_package.embeddings import MyEmbeddingsModel

class TestMyEmbeddingsModelUnit(EmbeddingsUnitTests):
    @property
    def embeddings_class(self) -> Type[MyEmbeddingsModel]:
        # Return the embeddings model class to test here
        return MyEmbeddingsModel

    @property
    def embedding_model_params(self) -> dict:
        # Return initialization parameters for the model.
        return {"model": "model-001"}
```
!!! note
    API references for individual test methods include troubleshooting tips.

Testing initialization from environment variables
    Overriding the `init_from_env_params` property will enable additional tests
    for initialization from environment variables. See below for details.

    ??? note "`init_from_env_params`"

        This property is used in unit tests to test initialization from
        environment variables. It should return a tuple of three dictionaries
        that specify the environment variables, additional initialization args,
        and expected instance attributes to check.

        Defaults to empty dicts. If not overridden, the test is skipped.

        ```python
        @property
        def init_from_env_params(self) -> Tuple[dict, dict, dict]:
            return (
                {
                    "MY_API_KEY": "api_key",
                },
                {
                    "model": "model-001",
                },
                {
                    "my_api_key": "api_key",
                },
            )
        ```

## Signature

```python
EmbeddingsUnitTests()
```

## Extends

- `EmbeddingsTests`

## Properties

- `init_from_env_params`

## Methods

- [`test_init()`](https://reference.langchain.com/python/langchain-tests/unit_tests/embeddings/EmbeddingsUnitTests/test_init)
- [`test_init_from_env()`](https://reference.langchain.com/python/langchain-tests/unit_tests/embeddings/EmbeddingsUnitTests/test_init_from_env)

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/fb6ab993a73180538f6cca876b3c85d46c08845f/libs/standard-tests/langchain_tests/unit_tests/embeddings.py#L34)