Skip to content

Commit

Permalink
test(time-series): add assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed Feb 22, 2024
1 parent df27d57 commit 97f433d
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions tests/plot/test_plot_time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@
"""


import numpy
import os
import unittest

import numpy
from pyneuroml.plot.PlotTimeSeries import *

from .. import BaseTestCase

logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)


class TestPlotTimeSeries(BaseTestCase):

"""Test PlotTimeSeries module"""

def test_plot_time_series(self):
"""Test plot_time_series function."""

npoints = 10000
npoints = 1000
traces_dict = {}
traces_dict["t"] = list(numpy.arange(0, 1000, 1000 / npoints))

Expand All @@ -35,8 +37,25 @@ def test_plot_time_series(self):
numpy.random.default_rng().uniform(-30, 80, npoints)
)

plot_time_series(traces_dict, title="", offset=False, show_plot_already=True)
plot_time_series(traces_dict, title="", offset=True, show_plot_already=True)
plot_time_series(
traces_dict,
title="",
offset=False,
show_plot_already=False,
save_figure_to="time-series-test.png",
)
plot_time_series(
traces_dict,
title="",
offset=True,
show_plot_already=False,
save_figure_to="time-series-test-2.png",
)
self.assertIsFile("time-series-test.png")
self.assertIsFile("time-series-test-2.png")

os.unlink("time-series-test.png")
os.unlink("time-series-test-2.png")


if __name__ == "__main__":
Expand Down

0 comments on commit 97f433d

Please sign in to comment.