@@ -717,39 +717,71 @@ def test_that_create_missing_columns_returns_expected_output_with_multi_col_df()
717717
718718
719719@pytest .mark .parametrize (
720- "input_df" ,
721- [
722- pd .DataFrame ({"some_col" : ["Val1" , "Val1" , "Val2" ]}),
723- ],
724- ids = ["missing_SAMPLE_CLASS_column" ],
720+ "input_df,col,values" ,
721+ [(pd .DataFrame ({"some_col" : ["Val1" , "Val1" , "Val2" ]}), "test_col" , "test_value" )],
722+ ids = ["missing_the_column" ],
725723)
726- def test_has_cfDNA_samples_no_SAMPLE_CLASS_column (input_df ):
724+ def test_check_values_in_column_no_column (input_df , col , values ):
727725 with patch .object (process_functions , "logger" ) as mock_logger :
728- results = process_functions .has_cfDNA_samples (input_df )
726+ results = process_functions .check_values_in_column (input_df , col , values )
729727 mock_logger .error .assert_called_once_with (
730- "Must have SAMPLE_CLASS column in the dataframe."
728+ "Must have test_col column in the dataframe."
731729 )
732730
733731
734732@pytest .mark .parametrize (
735- "input_df, expected_results" ,
733+ "input_df,col,values, expected_results" ,
736734 [
737735 (
738736 pd .DataFrame (
739737 {"SAMPLE_ID" : [1 , 2 , 3 ], "SAMPLE_CLASS" : ["Val1" , "Val1" , "Val2" ]}
740738 ),
739+ "SAMPLE_CLASS" ,
740+ "cfDNA" ,
741+ False ,
742+ ),
743+ (
744+ pd .DataFrame (
745+ {"SAMPLE_ID" : [1 , 2 , 3 ], "SAMPLE_CLASS" : ["Val1" , "Val1" , "Val2" ]}
746+ ),
747+ "SAMPLE_CLASS" ,
748+ ["test_value" , "cfDNA" ],
741749 False ,
742750 ),
743751 (
744752 pd .DataFrame (
745753 {"SAMPLE_ID" : [1 , 2 , 3 ], "SAMPLE_CLASS" : ["cfDNA" , "Val1" , "Val2" ]}
746754 ),
755+ "SAMPLE_CLASS" ,
756+ "cfDNA" ,
747757 True ,
748758 ),
759+ (
760+ pd .DataFrame (
761+ {"SAMPLE_ID" : [1 , 2 , 3 ], "SAMPLE_CLASS" : ["cfDNA" , "Tumor" , "Val2" ]}
762+ ),
763+ "SAMPLE_CLASS" ,
764+ ["cfDNA" , "Tumor" ],
765+ True ,
766+ ),
767+ (
768+ pd .DataFrame (
769+ {"SAMPLE_ID" : [1 , 2 , 3 ], "SAMPLE_CLASS" : ["cfDNA" , "Tumor" , "Val2" ]}
770+ ),
771+ "SAMPLE_CLASS" ,
772+ ["cfDNA" , "Tumor" , "test_value" ],
773+ True ,
774+ ),
775+ ],
776+ ids = [
777+ "no_expected_single_value" ,
778+ "no_expected_value_list" ,
779+ "have_expected_single_value" ,
780+ "have_expected_value_list" ,
781+ "have_partial_expected_value_list" ,
749782 ],
750- ids = ["no_cfDNA_sampless" , "have_cfDNA_samples" ],
751783)
752- def test_has_cfDNA_samples_has_SAMPLE_CLASS_column (input_df , expected_results ):
753- results = process_functions .has_cfDNA_samples (input_df )
784+ def test_check_values_in_column_has_column (input_df , col , values , expected_results ):
785+ results = process_functions .check_values_in_column (input_df , col , values )
754786
755787 assert results == expected_results
0 commit comments