Skip to content

Commit

Permalink
✅ added tests for lineplot
Browse files Browse the repository at this point in the history
  • Loading branch information
julkaar9 committed Jul 31, 2023
1 parent 4b72874 commit 0b43254
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd
import pytest

from pynimate.datafier import BarDatafier, BaseDatafier
from pynimate.datafier import BarDatafier, BaseDatafier, LineDatafier

dir_path = os.path.dirname(os.path.realpath(__file__))

Expand Down Expand Up @@ -43,6 +43,11 @@ def sample_data1_bardfr(sample_data1) -> BarDatafier:
return BarDatafier(sample_data1, "%Y-%m-%d", "3MS")


@pytest.fixture
def sample_data1_linedfr(sample_data1) -> BarDatafier:
return LineDatafier(sample_data1, "%Y-%m-%d", "3MS")


@pytest.fixture
def map_data() -> pd.DataFrame:
map_data = pd.read_csv(dir_path + "/data/map.csv").set_index("time")
Expand Down
3 changes: 3 additions & 0 deletions tests/test_datafier.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ def test_datafier_get_prepared_data(sample_data1):
assert dfr.data.equals(data)


# 1.2.0 >=


def test_basedatafier_interpolate_even(sample_data2):
dfr = BaseDatafier(sample_data2, "%Y", "3MS")
interpolated_data = pd.DataFrame(
Expand Down
28 changes: 28 additions & 0 deletions tests/test_lineplot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from pynimate.lineplot import Lineplot


def test_lineplot_linestyle(sample_data1_linedfr):
plot = Lineplot(sample_data1_linedfr)
linestyles = {
"Afghanistan": "solid",
"Angola": "solid",
"Albania": "solid",
"USA": "solid",
"Argentina": "solid",
}

assert plot.column_linestyles == linestyles


def test_lineplot_linestyle_dict(sample_data1_linedfr):
plot = Lineplot(sample_data1_linedfr)
plot.set_column_linestyles({"Albania": "dashed"})
linestyles = {
"Afghanistan": "solid",
"Angola": "solid",
"Albania": "dashed",
"USA": "solid",
"Argentina": "solid",
}

assert plot.column_linestyles == linestyles

0 comments on commit 0b43254

Please sign in to comment.