Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report validate method should be private #521

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdmetrics/reports/base_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _validate_metadata_matches_data(self, real_data, synthetic_data, metadata):
)
raise ValueError(error_message)

def validate(self, real_data, synthetic_data, metadata):
def _validate(self, real_data, synthetic_data, metadata):
"""Validate the inputs.

Args:
Expand Down Expand Up @@ -129,7 +129,7 @@ def generate(self, real_data, synthetic_data, metadata, verbose=True):
if not isinstance(metadata, dict):
raise TypeError('The provided metadata is not a dictionary.')

self.validate(real_data, synthetic_data, metadata)
self._validate(real_data, synthetic_data, metadata)
self.convert_datetimes(real_data, synthetic_data, metadata)

self.report_info['generated_date'] = datetime.today().strftime('%Y-%m-%d')
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/reports/test_base_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def test__validate_metadata_matches_data_no_mismatch(self):
# Run and Assert
base_report._validate_metadata_matches_data(real_data, synthetic_data, metadata)

def test_validate(self):
"""Test the ``validate`` method."""
def test__validate(self):
"""Test the ``_validate`` method."""
# Setup
base_report = BaseReport()
mock__validate_metadata_matches_data = Mock()
Expand All @@ -110,7 +110,7 @@ def test_validate(self):
}

# Run
base_report.validate(real_data, synthetic_data, metadata)
base_report._validate(real_data, synthetic_data, metadata)

# Assert
mock__validate_metadata_matches_data.assert_called_once_with(
Expand Down Expand Up @@ -236,7 +236,7 @@ def test_generate(self, version_mock, time_mock, datetime_mock):
mock_validate = Mock()
mock__print_results = Mock()
base_report._print_results = mock__print_results
base_report.validate = mock_validate
base_report._validate = mock_validate
base_report._properties['Property 1'] = Mock()
base_report._properties['Property 1'].get_score.return_value = 1.0
base_report._properties['Property 2'] = Mock()
Expand Down Expand Up @@ -295,7 +295,7 @@ def test_generate_multi_table_details(self, version_mock, time_mock, datetime_mo

base_report = BaseReport()
base_report._print_results = Mock()
base_report.validate = Mock()
base_report._validate = Mock()
base_report.convert_datetimes = Mock()
base_report._properties['Property 1'] = Mock()
base_report._properties['Property 1'].get_score.return_value = 1.0
Expand Down
Loading