@@ -416,6 +416,32 @@ def test_connection_config_with_credentials(
416416 table_dataset .load ()
417417 assert ("ibis" , key ) in table_dataset ._connections
418418
419+ @pytest .mark .parametrize (
420+ "credentials,expected_exception,expected_message" ,
421+ [
422+ (
423+ "postgresql://user:pass@localhost/db" ,
424+ ValueError ,
425+ "Connection string credentials are not supported" ,
426+ ),
427+ (123 , TypeError , "Credentials must be a dict" ),
428+ (["backend" , "duckdb" ], TypeError , "Credentials must be a dict" ),
429+ (("backend" , "duckdb" ), TypeError , "Credentials must be a dict" ),
430+ (True , TypeError , "Credentials must be a dict" ),
431+ ],
432+ )
433+ def test_invalid_credentials_types_raise (
434+ self , database_name , connection_config , credentials , expected_exception , expected_message
435+ ):
436+ """Test that invalid credentials types raise appropriate exceptions."""
437+ with pytest .raises (expected_exception , match = expected_message ):
438+ TableDataset (
439+ table_name = "test" ,
440+ database = database_name ,
441+ connection = connection_config ,
442+ credentials = credentials ,
443+ )
444+
419445 def test_save_data_loaded_using_file_dataset (self , file_dataset , table_dataset ):
420446 """Test interoperability of Ibis datasets sharing a database."""
421447 dummy_table = file_dataset .load ()
0 commit comments