44import itertools
55import json
66from collections .abc import Callable
7- from datetime import date , datetime
7+ from datetime import date , datetime , timedelta
88from decimal import Decimal
99from typing import Any
1010
@@ -155,10 +155,10 @@ def _make_comparison() -> DataFrameComparison:
155155
156156
157157@pytest .mark .parametrize (
158- "show_perfect_column_matches, show_top_column_changes, slim, sample_rows, sample_pk" ,
158+ "show_perfect_column_matches, show_top_column_changes, slim, sample_rows, sample_pk, hide_value " ,
159159 [
160- (* combo [:2 ], combo [2 ], combo [3 ], combo [3 ] and combo [1 ])
161- for combo in itertools .product ([True , False ], repeat = 4 )
160+ (* combo [:2 ], combo [2 ], combo [3 ], combo [3 ] and combo [1 ], combo [ 4 ] )
161+ for combo in itertools .product ([True , False ], repeat = 5 )
162162 ],
163163)
164164def test_summary_data_parametrized (
@@ -167,15 +167,18 @@ def test_summary_data_parametrized(
167167 slim : bool ,
168168 sample_rows : bool ,
169169 sample_pk : bool ,
170+ hide_value : bool ,
170171) -> None :
171172 comp = _make_comparison ()
172173 top_k = 3 if show_top_column_changes else 0
174+ hidden_columns = ["value" ] if hide_value else None
173175 summary = comp .summary (
174176 show_perfect_column_matches = show_perfect_column_matches ,
175177 top_k_column_changes = top_k ,
176178 sample_k_rows_only = 3 if sample_rows else 0 ,
177179 show_sample_primary_key_per_change = sample_pk ,
178180 slim = slim ,
181+ hidden_columns = hidden_columns ,
179182 )
180183 result = json .loads (summary .to_json ())
181184
@@ -194,11 +197,13 @@ def test_summary_data_parametrized(
194197 }
195198
196199 # Columns: status has 100% match rate, value has 2/3
197- # show_perfect_column_matches controls whether the perfect status column appears
200+ # - show_perfect_column_matches controls whether the perfect status column appears
201+ # - hide_value suppresses changes for value (top_k forced to 0 for hidden columns)
202+ show_value_changes = show_top_column_changes and not hide_value
198203 value_col = {
199204 "name" : "value" ,
200205 "match_rate" : pytest .approx (2 / 3 ),
201- "n_total_changes" : 1 if show_top_column_changes else 0 ,
206+ "n_total_changes" : 1 if show_value_changes else 0 ,
202207 "changes" : (
203208 [
204209 {
@@ -208,7 +213,7 @@ def test_summary_data_parametrized(
208213 "sample_pk" : [2 ] if sample_pk else None ,
209214 }
210215 ]
211- if show_top_column_changes
216+ if show_value_changes
212217 else None
213218 ),
214219 }
@@ -254,6 +259,7 @@ def test_summary_data_parametrized(
254259 (date (2024 , 1 , 1 ), "2024-01-01" ),
255260 (datetime (2024 , 1 , 1 , 12 , 0 , 0 ), "2024-01-01T12:00:00" ),
256261 (Decimal ("12.34" ), 12.34 ),
262+ (timedelta (hours = 1 , minutes = 30 ), 5400 ),
257263 ],
258264)
259265def test__to_python (input : Any , expected : Any ) -> None :
0 commit comments