Skip to content

Commit 686a190

Browse files
authored
Merge pull request lightspeed-core#956 from tisnik/lcore-1071-docstrings-for-config-unit-tests
LCORE-1071: docstrings for config unit tests
2 parents 76dcbb3 + 72b9aea commit 686a190

4 files changed

Lines changed: 51 additions & 6 deletions

File tree

tests/unit/models/config/test_byok_rag.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ def test_byok_rag_configuration_default_values() -> None:
3333

3434

3535
def test_byok_rag_configuration_nondefault_values() -> None:
36-
"""Test the ByokRag constructor."""
36+
"""Test the ByokRag constructor.
37+
38+
Verify that ByokRag class accepts and stores non-default configuration values.
39+
40+
Asserts that rag_id, rag_type, embedding_model, embedding_dimension, and
41+
vector_db_id match the provided inputs and that db_path is converted to a
42+
Path.
43+
"""
3744

3845
byok_rag = ByokRag(
3946
rag_id="rag_id",
@@ -83,7 +90,14 @@ def test_byok_rag_configuration_empty_rag_id() -> None:
8390

8491

8592
def test_byok_rag_configuration_empty_rag_type() -> None:
86-
"""Test the ByokRag constructor."""
93+
"""Test the ByokRag constructor.
94+
95+
Verify that constructing a ByokRag with an empty `rag_type` raises a validation error.
96+
97+
Raises:
98+
ValidationError: if `rag_type` is an empty string; error message
99+
includes "String should have at least 1 character".
100+
"""
87101

88102
with pytest.raises(
89103
ValidationError, match="String should have at least 1 character"

tests/unit/models/config/test_quota_scheduler_config.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ def test_quota_scheduler_default_configuration() -> None:
1818

1919

2020
def test_quota_scheduler_custom_configuration() -> None:
21-
"""Test the custom configuration."""
21+
"""Test the custom configuration.
22+
23+
Verify that QuotaSchedulerConfiguration accepts a custom period value.
24+
25+
Constructs a QuotaSchedulerConfiguration with period=10 and asserts the
26+
instance is created and its period equals 10 (the input value).
27+
"""
2228
cfg = QuotaSchedulerConfiguration(
2329
period=10,
2430
database_reconnection_count=2,

tests/unit/models/config/test_tls_configuration.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ def test_tls_configuration_wrong_password_path() -> None:
6868

6969

7070
def test_tls_configuration_certificate_path_to_directory() -> None:
71-
"""Test the TLS configuration loading when some path points to a directory."""
71+
"""Test the TLS configuration loading when some path points to a directory.
72+
73+
Verify that TLSConfiguration raises a ValueError when a provided TLS path
74+
points to a directory.
75+
76+
Raises:
77+
ValueError: If any of the provided TLS paths does not point to a file.
78+
"""
7279
with pytest.raises(ValueError, match="Path does not point to a file"):
7380
TLSConfiguration(
7481
tls_certificate_path=Path("tests/"),

tests/unit/models/config/test_user_data_collection.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ def test_user_data_collection_transcripts_enabled() -> None:
3333

3434

3535
def test_user_data_collection_transcripts_disabled() -> None:
36-
"""Test the UserDataCollection constructor for transcripts."""
36+
"""Test the UserDataCollection constructor for transcripts.
37+
38+
Verify the UserDataCollection constructor raises when transcripts are
39+
enabled but no storage is provided.
40+
41+
Asserts that constructing with transcripts_enabled=True and
42+
transcripts_storage=None raises a ValueError with the message
43+
"transcripts_storage is required when transcripts is enabled".
44+
"""
3745
# incorrect configuration
3846
with pytest.raises(
3947
ValueError,
@@ -43,7 +51,17 @@ def test_user_data_collection_transcripts_disabled() -> None:
4351

4452

4553
def test_user_data_collection_wrong_directory_path() -> None:
46-
"""Test the UserDataCollection constructor for wrong directory path."""
54+
"""Test the UserDataCollection constructor for wrong directory path.
55+
56+
Verify UserDataCollection raises InvalidConfigurationError when provided
57+
storage paths point to non-writable directories.
58+
59+
Ensures that enabling feedback with feedback_storage='/root' raises
60+
InvalidConfigurationError with message "Check directory to store feedback
61+
'/root' is not writable", and enabling transcripts with
62+
transcripts_storage='/root' raises InvalidConfigurationError with message
63+
"Check directory to store transcripts '/root' is not writable".
64+
"""
4765
with pytest.raises(
4866
InvalidConfigurationError,
4967
match="Check directory to store feedback '/root' is not writable",

0 commit comments

Comments
 (0)