mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
chore: enable lint PT009 'use regular assert over self.assert.*' (#30521)
This commit is contained in:
committed by
GitHub
parent
1f013055d2
commit
a849c29288
@@ -32,20 +32,14 @@ class TestPinotDbEngineSpec(TestDbEngineSpec):
|
||||
+ "DATETIMECONVERT(tstamp, '1:SECONDS:EPOCH', "
|
||||
+ "'1:SECONDS:EPOCH', '1:SECONDS') AS TIMESTAMP)) AS TIMESTAMP)"
|
||||
)
|
||||
self.assertEqual(
|
||||
result,
|
||||
expected,
|
||||
)
|
||||
assert result == expected
|
||||
|
||||
def test_pinot_time_expression_simple_date_format_1d_grain(self):
|
||||
col = column("tstamp")
|
||||
expr = PinotEngineSpec.get_timestamp_expr(col, "%Y-%m-%d %H:%M:%S", "P1D")
|
||||
result = str(expr.compile())
|
||||
expected = "CAST(DATE_TRUNC('day', CAST(tstamp AS TIMESTAMP)) AS TIMESTAMP)"
|
||||
self.assertEqual(
|
||||
result,
|
||||
expected,
|
||||
)
|
||||
assert result == expected
|
||||
|
||||
def test_pinot_time_expression_simple_date_format_10m_grain(self):
|
||||
col = column("tstamp")
|
||||
@@ -55,20 +49,14 @@ class TestPinotDbEngineSpec(TestDbEngineSpec):
|
||||
"CAST(ROUND(DATE_TRUNC('minute', CAST(tstamp AS "
|
||||
+ "TIMESTAMP)), 600000) AS TIMESTAMP)"
|
||||
)
|
||||
self.assertEqual(
|
||||
result,
|
||||
expected,
|
||||
)
|
||||
assert result == expected
|
||||
|
||||
def test_pinot_time_expression_simple_date_format_1w_grain(self):
|
||||
col = column("tstamp")
|
||||
expr = PinotEngineSpec.get_timestamp_expr(col, "%Y-%m-%d %H:%M:%S", "P1W")
|
||||
result = str(expr.compile())
|
||||
expected = "CAST(DATE_TRUNC('week', CAST(tstamp AS TIMESTAMP)) AS TIMESTAMP)"
|
||||
self.assertEqual(
|
||||
result,
|
||||
expected,
|
||||
)
|
||||
assert result == expected
|
||||
|
||||
def test_pinot_time_expression_sec_one_1m_grain(self):
|
||||
col = column("tstamp")
|
||||
@@ -79,10 +67,7 @@ class TestPinotDbEngineSpec(TestDbEngineSpec):
|
||||
+ "DATETIMECONVERT(tstamp, '1:SECONDS:EPOCH', "
|
||||
+ "'1:SECONDS:EPOCH', '1:SECONDS') AS TIMESTAMP)) AS TIMESTAMP)"
|
||||
)
|
||||
self.assertEqual(
|
||||
result,
|
||||
expected,
|
||||
)
|
||||
assert result == expected
|
||||
|
||||
def test_pinot_time_expression_millisec_one_1m_grain(self):
|
||||
col = column("tstamp")
|
||||
@@ -93,10 +78,7 @@ class TestPinotDbEngineSpec(TestDbEngineSpec):
|
||||
+ "DATETIMECONVERT(tstamp, '1:MILLISECONDS:EPOCH', "
|
||||
+ "'1:MILLISECONDS:EPOCH', '1:MILLISECONDS') AS TIMESTAMP)) AS TIMESTAMP)"
|
||||
)
|
||||
self.assertEqual(
|
||||
result,
|
||||
expected,
|
||||
)
|
||||
assert result == expected
|
||||
|
||||
def test_invalid_get_time_expression_arguments(self):
|
||||
with self.assertRaises(NotImplementedError):
|
||||
|
||||
Reference in New Issue
Block a user