FrancescoCastaldi commented on code in PR #43695:
URL: https://github.com/apache/superset/pull/43695#discussion_r4256925174
##########
superset/db_engine_specs/arc.py:
##########
@@ -42,9 +42,13 @@ class ArcEngineSpec(BaseEngineSpec):
metadata = {
"description": "Arc is a data platform with multiple connection
options.",
+ "logo": "arc.png",
+ "homepage_url": "https://arc.net",
Review Comment:
Updated. Removed homepage_url and docs_url from ArcEngineSpec metadata to
avoid misleading or unresolving links.
##########
tests/unit_tests/db_engine_specs/test_teradata.py:
##########
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import pytest
+
+from superset.db_engine_specs.teradata import TeradataEngineSpec
+
+
+def test_teradata_properties() -> None:
+ assert TeradataEngineSpec.engine == "teradatasql"
+ assert TeradataEngineSpec.engine_name == "Teradata"
+ assert TeradataEngineSpec.max_column_name_length == 30
+
+
+def test_teradata_metadata() -> None:
+ metadata = TeradataEngineSpec.metadata
+ desc = metadata["description"]
+ assert "Teradata is an enterprise data warehouse platform" in desc
+ assert metadata["logo"] == "teradata.png"
+ assert "teradatasqlalchemy" in metadata["pypi_packages"]
+ assert metadata["default_port"] == 1025
+
+
+def test_teradata_epoch_to_dttm() -> None:
+ assert "DATE '1970-01-01'" in
TeradataEngineSpec.epoch_to_dttm().format(col="ts")
Review Comment:
Updated. test_teradata_epoch_to_dttm now asserts the full formatted SQL
expression for col="ts", covering the complete date and seconds arithmetic.
##########
tests/unit_tests/db_engine_specs/test_lint_metadata.py:
##########
@@ -0,0 +1,115 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+# either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from pathlib import Path
+from textwrap import dedent
+
+import pytest
+
+from superset.db_engine_specs.lint_metadata import get_all_engine_specs_ast
+
+
+def _write_spec(directory: Path, filename: str, code: str) -> Path:
+ """Write a Python source file into *directory* and return the path."""
+ spec_file = directory / filename
+ spec_file.write_text(dedent(code), encoding="utf-8")
+ return spec_file
+
+
+def test_get_all_engine_specs_ast_annotated_attributes(
+ tmp_path: Path,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """
+ Engine specs with type-annotated engine, engine_name, and metadata
+ (inline initializers) are correctly discovered, including when named
+ with the *BaseEngineSpec suffix.
+ """
+ _write_spec(
+ tmp_path,
+ "_tmp_typed_inline.py",
+ """\
+ from typing import Any
+ from superset.db_engine_specs.base import BaseEngineSpec
+
+ class TypedInlineBaseEngineSpec(BaseEngineSpec):
+ engine: str = "typed_engine"
+ engine_name: str = "Typed Engine"
+ metadata: dict[str, Any] = {
Review Comment:
Added. Added test_get_all_engine_specs_ast_set_and_unary_minus in
test_lint_metadata.py with a set literal and unary negative numbers, verifying
both branches evaluate and preserve their values in the AST scan.
--
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]