liujiwen-up commented on code in PR #31580:
URL: https://github.com/apache/superset/pull/31580#discussion_r1895330170


##########
tests/unit_tests/db_engine_specs/test_doris.py:
##########
@@ -145,3 +151,52 @@ def test_get_schema_from_engine_params() -> None:
         )
         is None
     )
+
+
+def test_get_default_catalog() -> None:
+    """
+    Test the ``get_default_catalog`` method.
+    """
+    from superset.db_engine_specs.doris import DorisEngineSpec
+    from superset.models.core import Database
+
+    database = Mock(spec=Database)
+
+    # Test with catalog.schema format
+    database.url_object.database = "catalog1.schema1"
+    assert DorisEngineSpec.get_default_catalog(database) == "catalog1"
+
+    # Test with only catalog format
+    database.url_object.database = "catalog1"
+    assert DorisEngineSpec.get_default_catalog(database) == "catalog1"
+
+    # Test with None
+    database.url_object.database = None
+    assert DorisEngineSpec.get_default_catalog(database) is None

Review Comment:
   Thanks, I have changed it as requested.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to