Skip to content

Commit

Permalink
Address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed Jun 3, 2024
1 parent 0ece9ef commit 7f634ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 1 addition & 4 deletions metricflow/data_table/mf_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
9 changes: 6 additions & 3 deletions tests_metricflow/sql_clients/test_sql_client.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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


Expand Down

0 comments on commit 7f634ca

Please sign in to comment.