mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-18 08:03:36 +00:00
core: Add ruff rules for error messages (EM) (#26965)
All auto-fixes Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
committed by
GitHub
parent
37ca468d03
commit
d31ec8810a
@@ -106,7 +106,8 @@ def test_is_basemodel_subclass() -> None:
|
||||
|
||||
assert is_basemodel_subclass(BaseModelV1)
|
||||
else:
|
||||
raise ValueError(f"Unsupported Pydantic version: {PYDANTIC_MAJOR_VERSION}")
|
||||
msg = f"Unsupported Pydantic version: {PYDANTIC_MAJOR_VERSION}"
|
||||
raise ValueError(msg)
|
||||
|
||||
|
||||
def test_is_basemodel_instance() -> None:
|
||||
@@ -132,7 +133,8 @@ def test_is_basemodel_instance() -> None:
|
||||
|
||||
assert is_basemodel_instance(Bar(x=5))
|
||||
else:
|
||||
raise ValueError(f"Unsupported Pydantic version: {PYDANTIC_MAJOR_VERSION}")
|
||||
msg = f"Unsupported Pydantic version: {PYDANTIC_MAJOR_VERSION}"
|
||||
raise ValueError(msg)
|
||||
|
||||
|
||||
@pytest.mark.skipif(PYDANTIC_MAJOR_VERSION != 2, reason="Only tests Pydantic v2")
|
||||
|
@@ -177,7 +177,8 @@ def test_guard_import(
|
||||
elif package is not None and pip_name is not None:
|
||||
ret = guard_import(module_name, pip_name=pip_name, package=package)
|
||||
else:
|
||||
raise ValueError("Invalid test case")
|
||||
msg = "Invalid test case"
|
||||
raise ValueError(msg)
|
||||
assert ret == expected
|
||||
|
||||
|
||||
@@ -204,7 +205,8 @@ def test_guard_import_failure(
|
||||
elif package is not None and pip_name is not None:
|
||||
guard_import(module_name, pip_name=pip_name, package=package)
|
||||
else:
|
||||
raise ValueError("Invalid test case")
|
||||
msg = "Invalid test case"
|
||||
raise ValueError(msg)
|
||||
pip_name = pip_name or module_name.split(".")[0].replace("_", "-")
|
||||
err_msg = (
|
||||
f"Could not import {module_name} python package. "
|
||||
|
Reference in New Issue
Block a user