Module Diabetes-Detection-Web-Application.testing.tests.unit_tests.test_plots
Expand source code
"""
Test Cases for plots
"""
import pytest
import os
import pandas as pd
from src.preprocessing.plots import Plot
def test_hist_observation(mocker):
mocker.patch("src.preprocessing.plots.Plot.hist_observation", return_value=None)
path = "tests/unit_tests/test_data"
data = pd.read_csv("tests/unit_tests/test_data/sample.csv")
p = Plot(data, path)
assert os.path.isfile("tests/unit_tests/test_data/histogram.png")
def test_heatmap_observation(mocker):
mocker.patch("src.preprocessing.plots.Plot.heatmap_observation", return_value=None)
path = "tests/unit_tests/test_data"
data = pd.read_csv("tests/unit_tests/test_data/sample.csv")
p = Plot(data, path)
assert os.path.isfile("tests/unit_tests/test_data/heatmap.png")
Functions
def test_hist_observation(mocker)-
Test the test_hist_observation Function
Expand source code
def test_hist_observation(mocker): mocker.patch("src.preprocessing.plots.Plot.hist_observation", return_value=None) path = "tests/unit_tests/test_data" data = pd.read_csv("tests/unit_tests/test_data/sample.csv") p = Plot(data, path) assert os.path.isfile("tests/unit_tests/test_data/histogram.png") def test_heatmap_observation(mocker)-
Test the test_heatmap_observation Function
Expand source code
def test_heatmap_observation(mocker): mocker.patch("src.preprocessing.plots.Plot.heatmap_observation", return_value=None) path = "tests/unit_tests/test_data" data = pd.read_csv("tests/unit_tests/test_data/sample.csv") p = Plot(data, path) assert os.path.isfile("tests/unit_tests/test_data/heatmap.png")