Skip to content

Commit

Permalink
updated test with error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
axiomcura committed Sep 27, 2024
1 parent e421818 commit 5f4ac6e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 24 deletions.
7 changes: 1 addition & 6 deletions tests/test_cyto_utils/test_feature_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ def test_feature_infer_nocp():
with pytest.raises(ValueError) as nocp:
infer_cp_features(population_df=non_cp_data_df)

expected_message = (
"No features or metadata found. Pycytominer expects CellProfiler column names by default. "
"If you're using non-CellProfiler data, please do not 'infer' features. "
"Instead, check if the function has a `features` or `meta_features` parameter, and input column names manually."
)
assert expected_message in str(nocp.value)
assert "No features or metadata found." in str(nocp.value)


def test_metadata_feature_infer():
Expand Down
7 changes: 1 addition & 6 deletions tests/test_operations/test_correlation_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,7 @@ def test_correlation_threshold_featureinfer():
method="pearson",
)

expected_message = (
"No features or metadata found. Pycytominer expects CellProfiler column names by default. "
"If you're using non-CellProfiler data, please do not 'infer' features. "
"Instead, check if the function has a `features` or `meta_features` parameter, and input column names manually."
)
assert expected_message in str(nocp.value)
assert "No features found." in str(nocp.value)

data_cp_df = data_df.copy()
data_cp_df.columns = [f"Cells_{x}" for x in data_df.columns]
Expand Down
7 changes: 1 addition & 6 deletions tests/test_operations/test_get_na_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,4 @@ def test_get_na_columns_featureinfer():
population_df=data_df, samples="all", features="infer", cutoff=0.1
)

expected_message = (
"No features or metadata found. Pycytominer expects CellProfiler column names by default. "
"If you're using non-CellProfiler data, please do not 'infer' features. "
"Instead, check if the function has a `features` or `meta_features` parameter, and input column names manually."
)
assert expected_message in str(nocp.value)
assert "No features found." in str(nocp.value)
7 changes: 1 addition & 6 deletions tests/test_operations/test_variance_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,7 @@ def test_variance_threshold_featureinfer():
population_df=data_unique_test_df, features="infer", unique_cut=unique_cut
)

expected_message = (
"No features or metadata found. Pycytominer expects CellProfiler column names by default. "
"If you're using non-CellProfiler data, please do not 'infer' features. "
"Instead, check if the function has a `features` or `meta_features` parameter, and input column names manually."
)
assert expected_message in str(nocp.value)
assert "No features found." in str(nocp.value)

data_cp_df = data_unique_test_df.copy()
data_cp_df.columns = [f"Cells_{x}" for x in data_unique_test_df.columns]
Expand Down

0 comments on commit 5f4ac6e

Please sign in to comment.