-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from GatorEducator/test-case
Adding test-case for the data.py
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Pytest test suite for the filesystem module.""" | ||
|
||
from pathlib import Path | ||
|
||
from cellveyor import data | ||
|
||
|
||
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_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 |