Skip to content

Commit fb90a0e

Browse files
fix: Properly set separating lines in summary (#6)
1 parent 6d122df commit fb90a0e

53 files changed

Lines changed: 842 additions & 272 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

diffly/summary.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,12 @@ def _section_columns(self) -> RenderableType:
563563
"Column", max_width=COLUMN_SECTION_COLUMN_WIDTH, overflow=OVERFLOW
564564
)
565565
matches.add_column("Match Rate", justify="right")
566-
if any(
566+
has_top_changes_column = any(
567567
self.top_k_changes_by_column[col_name] > 0
568568
for col_name in self._comparison._other_common_columns
569569
if self._comparison.fraction_same()[col_name] < 1
570-
):
570+
)
571+
if has_top_changes_column:
571572
matches.add_column("Top Changes", justify="right")
572573
if self.show_perfect_column_matches:
573574
max_col_len = max(
@@ -635,7 +636,7 @@ def _section_columns(self) -> RenderableType:
635636

636637
matches.add_row(*columns)
637638
if (
638-
top_k_column_changes > 0
639+
has_top_changes_column
639640
or max_col_len > COLUMN_SECTION_COLUMN_WIDTH
640641
):
641642
matches.add_section()

docs/guides/features/summary.ipynb

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": null,
25+
"execution_count": 1,
2626
"metadata": {},
2727
"outputs": [],
2828
"source": [
@@ -41,7 +41,7 @@
4141
},
4242
{
4343
"cell_type": "code",
44-
"execution_count": 19,
44+
"execution_count": 2,
4545
"metadata": {},
4646
"outputs": [
4747
{
@@ -77,7 +77,7 @@
7777
"└────────────┴────────────┴──────────┴────────────┴───┴────────────┴──────────┴───────┴────────────┘"
7878
]
7979
},
80-
"execution_count": 19,
80+
"execution_count": 2,
8181
"metadata": {},
8282
"output_type": "execute_result"
8383
}
@@ -95,7 +95,7 @@
9595
},
9696
{
9797
"cell_type": "code",
98-
"execution_count": 20,
98+
"execution_count": 3,
9999
"metadata": {},
100100
"outputs": [],
101101
"source": [
@@ -119,7 +119,7 @@
119119
},
120120
{
121121
"cell_type": "code",
122-
"execution_count": 21,
122+
"execution_count": 4,
123123
"metadata": {},
124124
"outputs": [
125125
{
@@ -184,7 +184,7 @@
184184
},
185185
{
186186
"cell_type": "code",
187-
"execution_count": 22,
187+
"execution_count": 5,
188188
"metadata": {},
189189
"outputs": [
190190
{
@@ -247,7 +247,7 @@
247247
},
248248
{
249249
"cell_type": "code",
250-
"execution_count": 23,
250+
"execution_count": 6,
251251
"metadata": {},
252252
"outputs": [
253253
{
@@ -324,7 +324,7 @@
324324
},
325325
{
326326
"cell_type": "code",
327-
"execution_count": 24,
327+
"execution_count": 7,
328328
"metadata": {},
329329
"outputs": [
330330
{
@@ -362,6 +362,7 @@
362362
" │ │ │ \u001b[33m0.5\u001b[0m -> \u001b[33m1.0\u001b[0m (1x) │\n",
363363
" ├─────────────────┼─────────┼─────────────────────────────────────────────────┤\n",
364364
"\u001b[36mloyalty_card_id\u001b[0m │ 90.00% │ │\n",
365+
" ├─────────────────┼─────────┼─────────────────────────────────────────────────┤\n",
365366
"\u001b[36mproduct \u001b[0m │ 100.00% │ │\n",
366367
" ├─────────────────┼─────────┼─────────────────────────────────────────────────┤\n",
367368
"\u001b[36mquantity \u001b[0m │ 100.00% │ │\n",
@@ -400,7 +401,7 @@
400401
},
401402
{
402403
"cell_type": "code",
403-
"execution_count": 25,
404+
"execution_count": 8,
404405
"metadata": {},
405406
"outputs": [
406407
{
@@ -481,7 +482,7 @@
481482
},
482483
{
483484
"cell_type": "code",
484-
"execution_count": 26,
485+
"execution_count": 9,
485486
"metadata": {},
486487
"outputs": [
487488
{
@@ -540,7 +541,7 @@
540541
},
541542
{
542543
"cell_type": "code",
543-
"execution_count": 27,
544+
"execution_count": 10,
544545
"metadata": {},
545546
"outputs": [
546547
{
@@ -590,7 +591,7 @@
590591
],
591592
"metadata": {
592593
"kernelspec": {
593-
"display_name": "default",
594+
"display_name": "Python 3",
594595
"language": "python",
595596
"name": "python3"
596597
},
@@ -604,7 +605,7 @@
604605
"name": "python",
605606
"nbconvert_exporter": "python",
606607
"pygments_lexer": "ipython3",
607-
"version": "3.14.2"
608+
"version": "3.14.3"
608609
}
609610
},
610611
"nbformat": 4,

tests/summary/fixtures/equal_non_empty_different_columns/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@
2020
▔▔▔▔▔▔▔
2121
┌───────────┬─────────┬──┐
2222
│ speed_kph │ 100.00% │ │
23-
├───────────┼─────────┼──┤
2423
│ weight_kg │ 100.00% │ │
2524
└───────────┴─────────┴──┘

tests/summary/fixtures/equal_non_empty_different_columns/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@
2020
▔▔▔▔▔▔▔
2121
┌───────────┬─────────┬──┐
2222
│ speed_kph │ 100.00% │ │
23-
├───────────┼─────────┼──┤
2423
│ weight_kg │ 100.00% │ │
2524
└───────────┴─────────┴──┘

tests/summary/fixtures/equal_non_empty_different_columns/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/summary/fixtures/equal_non_empty_different_columns/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/summary/fixtures/gained_rows_only/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
▔▔▔▔▔▔▔
2323
┌─────────────────┬─────────┬──┐
2424
│ life_expectancy │ 100.00% │ │
25-
├─────────────────┼─────────┼──┤
2625
│ speed_kph │ 100.00% │ │
27-
├─────────────────┼─────────┼──┤
2826
│ weight_kg │ 100.00% │ │
2927
└─────────────────┴─────────┴──┘

tests/summary/fixtures/gained_rows_only/gen/pretty_False_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
▔▔▔▔▔▔▔
2323
┌─────────────────┬─────────┬──┐
2424
│ life_expectancy │ 100.00% │ │
25-
├─────────────────┼─────────┼──┤
2625
│ speed_kph │ 100.00% │ │
27-
├─────────────────┼─────────┼──┤
2826
│ weight_kg │ 100.00% │ │
2927
└─────────────────┴─────────┴──┘
3028

tests/summary/fixtures/gained_rows_only/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_False_sample_pk_False.txt

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/summary/fixtures/gained_rows_only/gen/pretty_True_perfect_True_top_True_slim_False_sample_rows_True_sample_pk_True.txt

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)