Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for mplot_dataframe_utils (for #88) #90

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [ "main", "docs", "patch", "feature", "mplot" ]
branches: [ "main", "docs", "patch", "feature", "mplot", "mplot-dev" ]
pull_request:
branches: [ "main" ]

Expand Down
11 changes: 6 additions & 5 deletions tests/test_mplot_dataframe_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import pandas as pd
from pandas.testing import assert_frame_equal

from forestplot.mplot_dataframe_utils import (
_insert_headers_models,
Expand Down Expand Up @@ -48,7 +49,7 @@ def test_insert_group_model():
result_df = insert_group_model(df, "groupvar", "varlabel", "model_col")

# Assert
pd.testing.assert_frame_equal(result_df, expected_df)
assert_frame_equal(result_df, expected_df)


def test_insert_headers_models():
Expand All @@ -72,9 +73,7 @@ def test_insert_headers_models():
result = _insert_headers_models(df, "model_col", None)

# Verify
pd.testing.assert_frame_equal(
result.reset_index(drop=True), expected_output.reset_index(drop=True)
)
assert_frame_equal(result.reset_index(drop=True), expected_output.reset_index(drop=True))


def test_make_multimodel_tableheaders():
Expand Down Expand Up @@ -205,4 +204,6 @@ def test_make_multimodel_tableheaders():
right_annoteheaders=None,
)
# Verify
pd.testing.assert_frame_equal(df_result, df_expected)
assert_frame_equal(df_result.iloc[:, :4], df_expected.iloc[:, :4])
assert pd.notna(df_result.loc[0, "yticklabel"])
assert pd.notna(df_result.loc[0, "yticklabel2"])
Loading