MCPcopy
hub / github.com/dbcli/pgcli / test_column_date_formats

Function test_column_date_formats

tests/test_main.py:77–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75
76
77def test_column_date_formats():
78 settings = OutputSettings(
79 table_format="psql",
80 column_date_formats={
81 "date_col": "%Y-%m-%d",
82 "datetime_col": "%I:%M:%S %m/%d/%y",
83 },
84 )
85 data = [
86 ("name1", "2024-12-13T18:32:22", "2024-12-13T19:32:22", "2024-12-13T20:32:22"),
87 ("name2", "2025-02-13T02:32:22", "2025-02-13T02:32:22", "2025-02-13T02:32:22"),
88 ]
89 headers = ["name", "date_col", "datetime_col", "unchanged_col"]
90
91 results = format_output("Title", data, headers, "test status", settings)
92 expected = [
93 "Title",
94 "+-------+------------+-------------------+---------------------+",
95 "| name | date_col | datetime_col | unchanged_col |",
96 "|-------+------------+-------------------+---------------------|",
97 "| name1 | 2024-12-13 | 07:32:22 12/13/24 | 2024-12-13T20:32:22 |",
98 "| name2 | 2025-02-13 | 02:32:22 02/13/25 | 2025-02-13T02:32:22 |",
99 "+-------+------------+-------------------+---------------------+",
100 "test status",
101 ]
102 assert list(results) == expected
103
104
105def test_no_column_date_formats():

Callers

nothing calls this directly

Calls 1

format_outputFunction · 0.90

Tested by

no test coverage detected