Home / Class/ TestClass Class — langchain Architecture

TestClass Class — langchain Architecture

Architecture documentation for the TestClass class in test_dump.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  394a49a9_2d6c_8718_fab8_41604a436cc5["TestClass"]
  e3623fbf_23b3_a8fc_0b7c_43b53f33b606["Serializable"]
  394a49a9_2d6c_8718_fab8_41604a436cc5 -->|extends| e3623fbf_23b3_a8fc_0b7c_43b53f33b606
  fa1913ed_53d8_ed72_5806_c4cd35bee49c["test_dump.py"]
  394a49a9_2d6c_8718_fab8_41604a436cc5 -->|defined in| fa1913ed_53d8_ed72_5806_c4cd35bee49c
  0023f5f1_4dd7_41ab_a99c_028d66cdf97c["get_from_env()"]
  394a49a9_2d6c_8718_fab8_41604a436cc5 -->|method| 0023f5f1_4dd7_41ab_a99c_028d66cdf97c
  fb53cdc6_e3c8_b670_f36f_87f76618cc6a["is_lc_serializable()"]
  394a49a9_2d6c_8718_fab8_41604a436cc5 -->|method| fb53cdc6_e3c8_b670_f36f_87f76618cc6a
  fc7e2295_fe63_bce4_1f4d_4a9cde9e52e5["get_lc_namespace()"]
  394a49a9_2d6c_8718_fab8_41604a436cc5 -->|method| fc7e2295_fe63_bce4_1f4d_4a9cde9e52e5
  5ab9cb7e_b84b_34d7_98d4_18bc4be4f63c["lc_secrets()"]
  394a49a9_2d6c_8718_fab8_41604a436cc5 -->|method| 5ab9cb7e_b84b_34d7_98d4_18bc4be4f63c

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/load/test_dump.py lines 87–118

class TestClass(Serializable):
    my_favorite_secret: str = Field(alias="my_favorite_secret_alias")
    my_other_secret: str = Field()

    model_config = ConfigDict(
        populate_by_name=True,
    )

    @model_validator(mode="before")
    @classmethod
    def get_from_env(cls, values: dict) -> Any:
        """Get the values from the environment."""
        if "my_favorite_secret" not in values:
            values["my_favorite_secret"] = os.getenv("MY_FAVORITE_SECRET")
        if "my_other_secret" not in values:
            values["my_other_secret"] = os.getenv("MY_OTHER_SECRET")
        return values

    @classmethod
    def is_lc_serializable(cls) -> bool:
        return True

    @classmethod
    def get_lc_namespace(cls) -> list[str]:
        return ["my", "special", "namespace"]

    @property
    def lc_secrets(self) -> dict[str, str]:
        return {
            "my_favorite_secret": "MY_FAVORITE_SECRET",
            "my_other_secret": "MY_OTHER_SECRET",
        }

Extends

Frequently Asked Questions

What is the TestClass class?
TestClass is a class in the langchain codebase, defined in libs/langchain/tests/unit_tests/load/test_dump.py.
Where is TestClass defined?
TestClass is defined in libs/langchain/tests/unit_tests/load/test_dump.py at line 87.
What does TestClass extend?
TestClass extends Serializable.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free