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

added test case for None columns #331

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
2 changes: 1 addition & 1 deletion synthetic_data/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _generate_uncorrelated_column_data(self, num_samples):

if not generator_name:
logging.warning(
f"Generator is {generator_name}. Null entries are not implemented."
f"Generator of type {generator_name} is not implemented."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue #326

)
continue

Expand Down
9 changes: 8 additions & 1 deletion tests/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,9 @@ def test_generate_uncorrelated_column_data(
else:
self.assertEqual(call_args_list[key], expected_calls[j][key])

@mock.patch("synthetic_data.generators.logging.warning")
@mock.patch("dataprofiler.profilers.StructuredProfiler.report")
def test_get_ordered_column_integration(self, mock_report):
def test_get_ordered_column_integration(self, mock_report, mock_warning):
mock_report.return_value = {
"data_stats": [
{
Expand Down Expand Up @@ -353,6 +354,9 @@ def test_get_ordered_column_integration(self, mock_report):
"max": "2030-04-23",
},
},
{
"data_type": None,
},
]
}
generator = TabularGenerator(profile=self.profile, is_correlated=False, seed=42)
Expand Down Expand Up @@ -386,6 +390,9 @@ def test_get_ordered_column_integration(self, mock_report):
expected_df = pd.DataFrame(expected_data)

actual_df = generator.synthesize(20)

self.assertEqual(mock_warning.call_count, 1)
mock_warning.assert_called_with(f"Generator of type None is not implemented.")
pd.testing.assert_frame_equal(expected_df, actual_df)

@mock.patch("dataprofiler.profilers.StructuredProfiler.report")
Expand Down