dpgaspar commented on a change in pull request #12581:
URL: https://github.com/apache/superset/pull/12581#discussion_r559527261



##########
File path: tests/db_engine_specs/bigquery_tests.py
##########
@@ -74,6 +74,28 @@ def test_timegrain_expressions(self):
             )
             self.assertEqual(str(actual), expected)
 
+    def test_custom_minute_timegrain_expressions(self):
+        """
+        DB Eng Specs (bigquery): Test time grain expressions
+        """
+        col = column("temporal")
+        test_cases = {
+            "DATE": "CAST(TIMESTAMP_SECONDS("
+            "5*60 * DIV(UNIX_SECONDS(CAST(temporal AS TIMESTAMP)), 5*60)"
+            ") AS DATE)",
+            "DATETIME": "CAST(TIMESTAMP_SECONDS("
+            "5*60 * DIV(UNIX_SECONDS(CAST(temporal AS TIMESTAMP)), 5*60)"
+            ") AS DATETIME)",
+            "TIMESTAMP": "CAST(TIMESTAMP_SECONDS("
+            "5*60 * DIV(UNIX_SECONDS(CAST(temporal AS TIMESTAMP)), 5*60)"
+            ") AS TIMESTAMP)",
+        }
+        for type_, expected in test_cases.items():
+            actual = BigQueryEngineSpec.get_timestamp_expr(
+                col=col, pdf=None, time_grain="PT5M", type_=type_
+            )
+            self.assertEqual(str(actual), expected)

Review comment:
       nit: we are using `assert` instead of `self.assertEqual`




----------------------------------------------------------------
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.

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