From 675ee77b0df45d1f1cd9d32a32e6f52094212048 Mon Sep 17 00:00:00 2001 From: yh202109 Date: Sun, 7 Jul 2024 13:52:54 -0400 Subject: [PATCH] v0.2.14 --- tests/test_statlab_corr.py | 30 +++++++++++++++++++ .../{test_kappa.py => test_statlab_kappa.py} | 0 2 files changed, 30 insertions(+) create mode 100644 tests/test_statlab_corr.py rename tests/{test_kappa.py => test_statlab_kappa.py} (100%) diff --git a/tests/test_statlab_corr.py b/tests/test_statlab_corr.py new file mode 100644 index 00000000..0e4683b7 --- /dev/null +++ b/tests/test_statlab_corr.py @@ -0,0 +1,30 @@ +import unittest +import pandas as pd +import numpy as np +from mtbp3.statlab.corr import CorrCalculator +import matplotlib.pyplot as plt + +class TestCorrCalculator(unittest.TestCase): + + def setUp(self): + self.y_df = pd.DataFrame({'x': [1, 2, 3, 4, 5], 'y': [2, 4, 6, 8, 10]}) + self.y_list = [[1, 2, 3, 4, 5], [2, 4, 6, 8, 10]] + self.corr_calculator_df = CorrCalculator(self.y_df) + self.corr_calculator_list = CorrCalculator(self.y_list) + + def test_calculate_kendall_tau_with_dataframe(self): + expected_tau = 1.0 + tau = self.corr_calculator_df.calculate_kendall_tau() + self.assertEqual(tau, expected_tau) + + def test_calculate_kendall_tau_with_list(self): + expected_tau = 1.0 + tau = self.corr_calculator_list.calculate_kendall_tau() + self.assertEqual(tau, expected_tau) + + def test_plot_y_list(self): + self.corr_calculator_df.plot_y_list() + # No assertion, just checking if the plot is displayed correctly + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/tests/test_kappa.py b/tests/test_statlab_kappa.py similarity index 100% rename from tests/test_kappa.py rename to tests/test_statlab_kappa.py