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

Function test_no_column_date_formats

tests/test_main.py:105–125  ·  view source on GitHub ↗

Test that not setting any column date formats returns unaltered datetime columns

()

Source from the content-addressed store, hash-verified

103
104
105def test_no_column_date_formats():
106 """Test that not setting any column date formats returns unaltered datetime columns"""
107 settings = OutputSettings(table_format="psql")
108 data = [
109 ("name1", "2024-12-13T18:32:22", "2024-12-13T19:32:22", "2024-12-13T20:32:22"),
110 ("name2", "2025-02-13T02:32:22", "2025-02-13T02:32:22", "2025-02-13T02:32:22"),
111 ]
112 headers = ["name", "date_col", "datetime_col", "unchanged_col"]
113
114 results = format_output("Title", data, headers, "test status", settings)
115 expected = [
116 "Title",
117 "+-------+---------------------+---------------------+---------------------+",
118 "| name | date_col | datetime_col | unchanged_col |",
119 "|-------+---------------------+---------------------+---------------------|",
120 "| name1 | 2024-12-13T18:32:22 | 2024-12-13T19:32:22 | 2024-12-13T20:32:22 |",
121 "| name2 | 2025-02-13T02:32:22 | 2025-02-13T02:32:22 | 2025-02-13T02:32:22 |",
122 "+-------+---------------------+---------------------+---------------------+",
123 "test status",
124 ]
125 assert list(results) == expected
126
127
128def test_format_output_truncate_on():

Callers

nothing calls this directly

Calls 1

format_outputFunction · 0.90

Tested by

no test coverage detected