Skip to content

Commit

Permalink
Add tests for mplot_dataframe_utils (for #88) (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
LSYS authored Dec 15, 2023
1 parent 1adcb7c commit 976f58d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
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"])

0 comments on commit 976f58d

Please sign in to comment.