From 7f634cadb755282b7cc1f6ee9acc3546635b7c3d Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Sun, 2 Jun 2024 22:29:29 -0700 Subject: [PATCH] Address comments. --- metricflow/data_table/mf_table.py | 5 +---- tests_metricflow/sql_clients/test_sql_client.py | 9 ++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/metricflow/data_table/mf_table.py b/metricflow/data_table/mf_table.py index 5634d1680d..b146742256 100644 --- a/metricflow/data_table/mf_table.py +++ b/metricflow/data_table/mf_table.py @@ -142,10 +142,7 @@ def text_format(self, float_decimals: int = 2) -> str: continue if isinstance(cell_value, datetime.datetime): - if cell_value.time() == datetime.time.min: - str_row.append(cell_value.date().isoformat()) - else: - str_row.append(cell_value.isoformat()) + str_row.append(cell_value.isoformat()) continue str_row.append(str(cell_value)) diff --git a/tests_metricflow/sql_clients/test_sql_client.py b/tests_metricflow/sql_clients/test_sql_client.py index 65bfe34507..a6a2ac23cb 100644 --- a/tests_metricflow/sql_clients/test_sql_client.py +++ b/tests_metricflow/sql_clients/test_sql_client.py @@ -1,7 +1,7 @@ from __future__ import annotations import logging -from typing import Set, Union +from typing import Optional, Set, Union import pytest from dbt_semantic_interfaces.test_utils import as_datetime @@ -26,13 +26,16 @@ def _select_x_as_y(x: int = 1, y: str = "y") -> str: return f"SELECT {x} AS {y}" -def _check_1col(df: MetricFlowDataTable, col: str = "y", vals: Set[Union[int, str]] = {1}) -> None: +def _check_1col(df: MetricFlowDataTable, col: str = "y", vals: Optional[Set[Union[int, str]]] = None) -> None: """Helper to check that 1 column has the same value and a case-insensitive matching name. We lower-case the names due to snowflake's tendency to capitalize things. This isn't ideal but it'll do for now. """ + if vals is None: + vals = {1} + assert df.column_count == 1 - assert df.column_names == (col,) + assert tuple(column_name.lower() for column_name in df.column_names) == (col.lower(),) assert set(df.column_values_iterator(0)) == vals