Skip to content

Commit e60f2a1

Browse files
committed
Add visualization test
1 parent 553ba4c commit e60f2a1

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

tests/integration/reports/multi_table/test_quality_report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def test_column_pair_trends_threshold_changes_details():
289289
.loc[lambda df: df['Property'] == 'Column Pair Trends', 'Score']
290290
.iloc[0]
291291
)
292-
score_defaul_intertable = (
292+
score_default_intertable = (
293293
report_default
294294
.get_properties()
295295
.loc[lambda df: df['Property'] == 'Intertable Trends', 'Score']
@@ -304,7 +304,7 @@ def test_column_pair_trends_threshold_changes_details():
304304

305305
# Assert
306306
assert score_zero >= score_default # scores should be approximately 0.4 > 0.3
307-
assert score_zero_intertable >= score_defaul_intertable # approximately 0.45 > 0.4
307+
assert score_zero_intertable >= score_default_intertable # approximately 0.45 > 0.4
308308

309309

310310
def test_quality_report_with_object_datetimes():

tests/unit/reports/single_table/_properties/test_column_pair_trends.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,3 +541,35 @@ def test_get_visualization(self, mock_make_subplots):
541541
assert fig_mock.add_trace.call_count == 3
542542
cpt_property._update_layout.assert_called_once_with(fig_mock)
543543
assert result == fig_mock
544+
545+
def test_get_visualization_layout_alignment(self):
546+
"""Test layout settings that keep subplots aligned."""
547+
# Setup
548+
cpt_property = ColumnPairTrends()
549+
cpt_property.details = pd.DataFrame({
550+
'Column 1': ['col1'],
551+
'Column 2': ['col2'],
552+
'Metric': ['CorrelationSimilarity'],
553+
'Score': [0.75],
554+
'Real Correlation': [0.5],
555+
'Synthetic Correlation': [0.6],
556+
'Real Association': [0.2],
557+
'Meets Threshold?': [True],
558+
})
559+
560+
# Run
561+
fig = cpt_property.get_visualization()
562+
563+
# Assert
564+
assert fig.layout.height == 900
565+
assert fig.layout.width == 900
566+
assert fig.layout.xaxis3.matches == 'x2'
567+
assert fig.layout.yaxis3.matches == 'y2'
568+
assert fig.layout.yaxis3.visible is False
569+
assert fig.layout.coloraxis.cmin == 0
570+
assert fig.layout.coloraxis.cmax == 1
571+
assert fig.layout.coloraxis.colorbar.x == 0.8
572+
assert fig.layout.coloraxis.colorbar.y == 0.8
573+
assert fig.layout.coloraxis2.cmin == -1
574+
assert fig.layout.coloraxis2.cmax == 1
575+
assert fig.layout.coloraxis2.colorbar.y == 0.2

0 commit comments

Comments
 (0)