diff --git a/packages/jupyter-ai/jupyter_ai/tests/test_config_manager.py b/packages/jupyter-ai/jupyter_ai/tests/test_config_manager.py index 9f0349b1c..ce2ae5786 100644 --- a/packages/jupyter-ai/jupyter_ai/tests/test_config_manager.py +++ b/packages/jupyter-ai/jupyter_ai/tests/test_config_manager.py @@ -47,7 +47,7 @@ def common_cm_kwargs(config_path, schema_path): "embeddings_provider_id": None, "api_keys": None, "fields": None, - } + }, } @@ -103,6 +103,7 @@ def cm_with_allowlists(common_cm_kwargs): } return ConfigManager(**kwargs) + def cm_with_defaults(cm_kargs_with_defaults): """The default ConfigManager instance, with an empty config and config schema.""" return ConfigManager(**cm_kargs_with_defaults) @@ -226,8 +227,9 @@ def test_init_with_allowlists(cm: ConfigManager, common_cm_kwargs): assert test_cm.lm_gid == None assert test_cm.em_gid == None + def test_init_with_default_values( - cm_with_defaults: ConfigManager, config_path: str, schema_path: str + cm_with_defaults: ConfigManager, config_path: str, schema_path: str ): """ Test that the ConfigManager initializes with the expected default values. @@ -238,18 +240,25 @@ def test_init_with_default_values( schema_path (str): The path to the schema file. """ config_response = cm_with_defaults.get_config() - #assert config response + # assert config response assert config_response.model_provider_id == "bedrock-chat:anthropic.claude-v1" - assert config_response.embeddings_provider_id == "bedrock:amazon.titan-embed-text-v1" + assert ( + config_response.embeddings_provider_id == "bedrock:amazon.titan-embed-text-v1" + ) assert config_response.api_keys == ["OPENAI_API_KEY"] - assert config_response.fields == {"bedrock-chat:anthropic.claude-v1":{"credentials_profile_name": "default","region_name": "us-west-2"}} + assert config_response.fields == { + "bedrock-chat:anthropic.claude-v1": { + "credentials_profile_name": "default", + "region_name": "us-west-2", + } + } del cm_with_defaults log = logging.getLogger() lm_providers = get_lm_providers() em_providers = get_em_providers() - cm_with_defaults_override =ConfigManager( + cm_with_defaults_override = ConfigManager( log=log, lm_providers=lm_providers, em_providers=em_providers, @@ -261,7 +270,7 @@ def test_init_with_default_values( def test_init_with_default_values( - cm_with_defaults: ConfigManager, config_path: str, schema_path: str + cm_with_defaults: ConfigManager, config_path: str, schema_path: str ): """ Test that the ConfigManager initializes with the expected default values. @@ -272,18 +281,25 @@ def test_init_with_default_values( schema_path (str): The path to the schema file. """ config_response = cm_with_defaults.get_config() - #assert config response + # assert config response assert config_response.model_provider_id == "bedrock-chat:anthropic.claude-v1" - assert config_response.embeddings_provider_id == "bedrock:amazon.titan-embed-text-v1" + assert ( + config_response.embeddings_provider_id == "bedrock:amazon.titan-embed-text-v1" + ) assert config_response.api_keys == ["OPENAI_API_KEY"] - assert config_response.fields == {"bedrock-chat:anthropic.claude-v1":{"credentials_profile_name": "default","region_name": "us-west-2"}} + assert config_response.fields == { + "bedrock-chat:anthropic.claude-v1": { + "credentials_profile_name": "default", + "region_name": "us-west-2", + } + } del cm_with_defaults log = logging.getLogger() lm_providers = get_lm_providers() em_providers = get_em_providers() - cm_with_defaults_override =ConfigManager( + cm_with_defaults_override = ConfigManager( log=log, lm_providers=lm_providers, em_providers=em_providers, @@ -293,7 +309,10 @@ def test_init_with_default_values( provider_defaults={"model_provider_id": "bedrock-chat:anthropic.claude-v2"}, ) - assert cm_with_defaults_override.get_config().model_provider_id == "bedrock-chat:anthropic.claude-v2" + assert ( + cm_with_defaults_override.get_config().model_provider_id + == "bedrock-chat:anthropic.claude-v2" + ) def test_init_with_default_values(