Skip to content

Commit

Permalink
tests for colnames(metadata) check added
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinaGomoryova committed Jun 19, 2024
1 parent 1d5fdf1 commit c9dc679
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/test_process_metadata_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def dataframe() -> pd.DataFrame:

return pd.DataFrame(data = d)


@pytest.fixture
def processed_dataframe() -> pd.DataFrame:
d = {
Expand Down Expand Up @@ -235,6 +234,25 @@ def test_process_metadata_file(processed_dataframe: pd.DataFrame, tmp_path: str)
actual = pd.read_csv(out_path, sep='\t')
assert actual.equals(processed_dataframe)

@pytest.mark.parametrize("file_name",
["batch_specification1.csv", "batch_specification1.xlsx", "batch_specification1.txt"])
def test_read_file_colnames_input(file_name: str, dataframe: pd.DataFrame):
file_path = __location__.joinpath("test_data", file_name)
#file_path = os.path.join("tests", "test_data", file_name)
actual_df = read_file(str(file_path))
actual = actual_df.columns
expected = dataframe.columns
assert expected.equals(actual)

def test_process_metadata_file_colnames_output(processed_dataframe: pd.DataFrame, tmp_path: str):
file_path = os.path.join("tests", "test_data", "batch_specification1.csv")
out_path = os.path.join(tmp_path, "processed_batch_specification1.tsv")
process_metadata_file(file_path, out_path)
expected = processed_dataframe.columns
actual_df = pd.read_csv(out_path, sep='\t')
actual = actual_df.columns
assert expected.equals(actual)

def test_process_alkane_ri_file(alkanes: pd.DataFrame, tmp_path: str):
file_path = os.path.join("tests", "test_data", "Alkane_RI_ATHLETE_1.txt")
out_path = os.path.join(tmp_path, "processed_Alkane_RI_ATHLETE_1.tsv")
Expand Down

0 comments on commit c9dc679

Please sign in to comment.