From 479076c1d95166d23358d1c37e8ded00f47f9625 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Tue, 6 Jan 2026 09:36:06 +0100 Subject: [PATCH 1/5] Updated docstrings in tests/unit/models/config/test_cors.py --- tests/unit/models/config/test_cors.py | 32 ++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/tests/unit/models/config/test_cors.py b/tests/unit/models/config/test_cors.py index ab79f02f2..f032d9e6f 100644 --- a/tests/unit/models/config/test_cors.py +++ b/tests/unit/models/config/test_cors.py @@ -6,7 +6,17 @@ def test_cors_default_configuration() -> None: - """Test the CORS configuration.""" + """Test the CORS configuration. + + Verify that a default CORSConfiguration instance has the expected default + values. + + Asserts that: + - allow_origins is ["*"] + - allow_credentials is False + - allow_methods is ["*"] + - allow_headers is ["*"] + """ cfg = CORSConfiguration() assert cfg is not None assert cfg.allow_origins == ["*"] @@ -46,7 +56,15 @@ def test_cors_custom_configuration_v2() -> None: def test_cors_custom_configuration_v3() -> None: - """Test the CORS configuration.""" + """Test the CORS configuration. + + Verify that CORSConfiguration accepts a wildcard origin when credentials + are disabled and preserves provided methods and headers. + + Creates a CORSConfiguration with allow_origins ["*"], allow_credentials + False, and explicit allow_methods and allow_headers, then asserts the + instance exists and its attributes match the provided values. + """ cfg = CORSConfiguration( allow_origins=["*"], allow_credentials=False, @@ -61,7 +79,15 @@ def test_cors_custom_configuration_v3() -> None: def test_cors_improper_configuration() -> None: - """Test the CORS configuration.""" + """Test the CORS configuration. + + Verify that constructing CORSConfiguration with a wildcard origin and + credentials enabled raises a ValueError. + + Asserts the raised ValueError contains the message that `allow_credentials` + cannot be true when `allow_origins` contains the '*' wildcard and advises + using explicit origins or disabling credentials. + """ expected = ( "Value error, Invalid CORS configuration: " + "allow_credentials can not be set to true when allow origins contains the '\\*' wildcard." From 61bff0fd6661d23519f573f254bd8ff2668be63e Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Tue, 6 Jan 2026 09:36:18 +0100 Subject: [PATCH 2/5] Updated docstrings in tests/unit/models/config/test_customization.py --- .../unit/models/config/test_customization.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/unit/models/config/test_customization.py b/tests/unit/models/config/test_customization.py index d3a5fa22a..0b6f2f195 100644 --- a/tests/unit/models/config/test_customization.py +++ b/tests/unit/models/config/test_customization.py @@ -9,7 +9,24 @@ def test_service_customization(subtests: SubTests) -> None: - """Check the service customization class.""" + """Check the service customization class. + + Run subtests validating Customization model loading and disable-flag behavior. + + Performs three subtests: + - "System prompt is enabled": verifies defaults + (disable_query_system_prompt is False; system_prompt_path and + system_prompt are None). + - "System prompt is disabled": verifies disable_query_system_prompt is True + and prompt fields remain None. + - "Disabled overrides provided path, but the prompt is still loaded": + verifies that providing a system_prompt_path while + disable_query_system_prompt is True still loads the prompt content, and + the disable flag remains True. + + Parameters: + subtests (SubTests): Pytest SubTests context used to group related assertions. + """ with subtests.test(msg="System prompt is enabled"): c = Customization() assert c is not None From ffd2d523f03d356e831e7f7b35d218eb95cb3772 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Tue, 6 Jan 2026 09:36:29 +0100 Subject: [PATCH 3/5] Updated docstrings in tests/unit/models/config/test_database_configuration.py --- .../models/config/test_database_configuration.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/unit/models/config/test_database_configuration.py b/tests/unit/models/config/test_database_configuration.py index f26e8df15..4c28b338f 100644 --- a/tests/unit/models/config/test_database_configuration.py +++ b/tests/unit/models/config/test_database_configuration.py @@ -65,7 +65,18 @@ def test_no_databases_configuration() -> None: def test_two_databases_configuration() -> None: - """Test if two databases configuration is checked.""" + """Test if two databases configuration is checked. + + Verify that constructing DatabaseConfiguration with both PostgreSQL and + SQLite configurations raises a validation error. + + Asserts that passing both `postgres` and `sqlite` to DatabaseConfiguration + triggers a `ValidationError` with message "Only one database configuration + can be provided". + + Raises: + ValidationError: If more than one database configuration is provided. + """ d1 = PostgreSQLDatabaseConfiguration(db="db", user="user", password="password") d2 = SQLiteDatabaseConfiguration(db_path="foo_bar_baz") with pytest.raises( From 0b0e0f38c5ce54fd1410367899f0c7a7bf3b4625 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Tue, 6 Jan 2026 09:36:40 +0100 Subject: [PATCH 4/5] Updated docstrings in tests/unit/models/config/test_postgresql_database_configuration.py --- .../test_postgresql_database_configuration.py | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/unit/models/config/test_postgresql_database_configuration.py b/tests/unit/models/config/test_postgresql_database_configuration.py index b25a7405e..ea655cf4e 100644 --- a/tests/unit/models/config/test_postgresql_database_configuration.py +++ b/tests/unit/models/config/test_postgresql_database_configuration.py @@ -50,7 +50,15 @@ def test_postgresql_database_configuration_namespace_specification() -> None: def test_postgresql_database_configuration_port_setting(subtests: SubTests) -> None: - """Test the PostgreSQLDatabaseConfiguration model.""" + """Test the PostgreSQLDatabaseConfiguration model. + + Validate port handling of PostgreSQLDatabaseConfiguration. + + Checks three scenarios: + - A valid explicit port (1234) is preserved on the model. + - A negative port raises ValidationError with message "Input should be greater than 0". + - A port >= 65536 raises ValueError with message "Port value should be less than 65536". + """ with subtests.test(msg="Correct port value"): c = PostgreSQLDatabaseConfiguration( db="db", user="user", password="password", port=1234 @@ -72,7 +80,18 @@ def test_postgresql_database_configuration_port_setting(subtests: SubTests) -> N def test_postgresql_database_configuration_ca_cert_path(subtests: SubTests) -> None: - """Test the PostgreSQLDatabaseConfiguration model.""" + """Test the PostgreSQLDatabaseConfiguration model. + + Validate ca_cert_path handling in PostgreSQLDatabaseConfiguration. + + Verifies two behaviors using subtests: + - When `ca_cert_path` points to an existing file, the value is preserved on the model. + - When `ca_cert_path` points to a non-existent path, a ValidationError is + raised with the message "Path does not point to a file". + + Parameters: + subtests (SubTests): Test helper providing subtest contexts. + """ with subtests.test(msg="Path exists"): c = PostgreSQLDatabaseConfiguration( db="db", From eebfe9c596a0edd7fcf602fc483e2381166d05f9 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Tue, 6 Jan 2026 09:36:48 +0100 Subject: [PATCH 5/5] Updated docstrings in tests/unit/models/config/test_quota_limiter_config.py --- .../config/test_quota_limiter_config.py | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/unit/models/config/test_quota_limiter_config.py b/tests/unit/models/config/test_quota_limiter_config.py index b704ebf0d..e5b640e15 100644 --- a/tests/unit/models/config/test_quota_limiter_config.py +++ b/tests/unit/models/config/test_quota_limiter_config.py @@ -23,7 +23,12 @@ def test_quota_limiter_configuration() -> None: def test_quota_limiter_configuration_improper_value_1() -> None: - """Test the default configuration.""" + """Test the default configuration. + + Verify that constructing a QuotaLimiterConfiguration with a negative + `initial_quota` raises a ValueError with message "Input should be greater + than or equal to 0". + """ with pytest.raises(ValueError, match="Input should be greater than or equal to 0"): _ = QuotaLimiterConfiguration( type="cluster_limiter", @@ -35,7 +40,14 @@ def test_quota_limiter_configuration_improper_value_1() -> None: def test_quota_limiter_configuration_improper_value_2() -> None: - """Test the default configuration.""" + """Test the default configuration. + + Verify that providing a negative `quota_increase` raises a ValueError. + + Asserts that constructing a QuotaLimiterConfiguration with `quota_increase` + less than zero raises a ValueError with the message "Input should be + greater than or equal to 0". + """ with pytest.raises(ValueError, match="Input should be greater than or equal to 0"): _ = QuotaLimiterConfiguration( type="cluster_limiter", @@ -47,7 +59,14 @@ def test_quota_limiter_configuration_improper_value_2() -> None: def test_quota_limiter_configuration_improper_value_3() -> None: - """Test the default configuration.""" + """Test the default configuration. + + Check that constructing QuotaLimiterConfiguration with an invalid `type` + raises a ValueError with the expected message. + + Raises: + ValueError: if `type` is not 'user_limiter' or 'cluster_limiter'. + """ with pytest.raises( ValueError, match="Input should be 'user_limiter' or 'cluster_limiter'" ):