Skip to content

Commit

Permalink
passing build
Browse files Browse the repository at this point in the history
  • Loading branch information
KevenDuverglas committed Dec 4, 2023
1 parent c91ca0f commit ca862ee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions cellveyor/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def access_dataframes(spreadsheet_file: Path) -> Dict[str, pandas.DataFrame]:
name_to_dataframe_dict = pandas.read_excel(spreadsheet_file, sheet_name=None)
return name_to_dataframe_dict


def key_attribute_column_filter(
sheet_dataframe: pandas.DataFrame,
key_attribute_name: str,
Expand Down
36 changes: 18 additions & 18 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
def test_access_dataframes() -> None:
spreadsheet_file_one = Path("spreadsheets/fake_spreadsheet.xlsx")
spreadsheet_file_two = Path("spreadsheets/example_spreadsheet.xlsx")
test_one= data.access_dataframes(spreadsheet_file_one)
test_one = data.access_dataframes(spreadsheet_file_one)
test_two = data.access_dataframes(spreadsheet_file_two)
assert test_one != test_two

def test_key_attribute_column_filter() -> None:
# Test key_attribute_column_filter function
dataframes_dict = data.access_dataframes(Path("spreadsheets/fake_spreadsheet.xlsx"))
sheet1_dataframe = dataframes_dict['Main']

# Test filtering with a key attribute and columns regex
key_attribute_name = "Student GitHub"
column_regexp = "^(Summary Grade|Final Grade) .*$"
key_attribute_value = "gkapfham"
selected_columns, result_df = data.key_attribute_column_filter(
sheet1_dataframe, key_attribute_name, column_regexp, key_attribute_value
)

assert(('Summary Grade for Team Participation')in selected_columns.columns)
assert(('Student GitHub') in result_df.columns)
assert key_attribute_value in result_df['Student GitHub'].values

def test_key_attribute_column_filter() -> None:
# Test key_attribute_column_filter function
dataframes_dict = data.access_dataframes(Path("spreadsheets/fake_spreadsheet.xlsx"))
sheet1_dataframe = dataframes_dict["Main"]

# Test filtering with a key attribute and columns regex
key_attribute_name = "Student GitHub"
column_regexp = "^(Summary Grade|Final Grade) .*$"
key_attribute_value = "gkapfham"
selected_columns, result_df = data.key_attribute_column_filter(
sheet1_dataframe, key_attribute_name, column_regexp, key_attribute_value
)

assert ("Summary Grade for Team Participation") in selected_columns.columns
assert ("Student GitHub") in result_df.columns
assert key_attribute_value in result_df["Student GitHub"].values

0 comments on commit ca862ee

Please sign in to comment.