ref: Auto-fix ruff rules in tests (#4154)

This commit is contained in:
Christophe Bornet 2024-10-16 17:42:36 +02:00 • committed by GitHub
commit 45c8f98692
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
80 changed files with 359 additions and 456 deletions

View file

@ -3,7 +3,7 @@ from langflow.utils.connection_string_parser import transform_connection_string
@pytest.mark.parametrize(
"connection_string, expected",
("connection_string", "expected"),
[
("protocol:user:password@host", "protocol:user:password@host"),
("protocol:user@host", "protocol:user@host"),

View file

@ -3,7 +3,7 @@ from langflow.base.data.utils import format_directory_path
@pytest.mark.parametrize(
"input_path, expected",
("input_path", "expected"),
[
# Test case 1: Standard path with no newlines (no change expected)
("/home/user/documents/file.txt", "/home/user/documents/file.txt"),

View file

@ -1,9 +1,9 @@
from langflow.base.data.utils import format_directory_path
import pytest
from langflow.base.data.utils import format_directory_path
@pytest.mark.parametrize(
"input_path, expected",
("input_path", "expected"),
[
# Test case 1: Standard path with no newlines
("/home/user/documents/file.txt", "/home/user/documents/file.txt"),

View file

@ -1,9 +1,11 @@
import math
import pytest
from langflow.utils.util_strings import truncate_long_strings
@pytest.mark.parametrize(
"input_data, max_length, expected",
("input_data", "max_length", "expected"),
[
# Test case 1: String shorter than max_length
("short string", 20, "short string"),
@ -20,7 +22,7 @@ from langflow.utils.util_strings import truncate_long_strings
# Test case 7: Integer input
(12345, 3, 12345),
# Test case 8: Float input
(3.14159, 4, 3.14159),
(math.pi, 4, math.pi),
# Test case 9: Boolean input
(True, 2, True),
# Test case 10: None input

View file

@ -1,10 +1,10 @@
from langflow.utils.util_strings import truncate_long_strings
from langflow.utils.constants import MAX_TEXT_LENGTH
import pytest
from langflow.utils.constants import MAX_TEXT_LENGTH
from langflow.utils.util_strings import truncate_long_strings
@pytest.mark.parametrize(
"input_data, max_length, expected",
("input_data", "max_length", "expected"),
[
# Test case 1: Simple string truncation
({"key": "a" * 100}, 10, {"key": "a" * 10 + "..."}),