Skip to content

Commit

Permalink
v0.2.14
Browse files Browse the repository at this point in the history
  • Loading branch information
yh202109 committed Jul 7, 2024
1 parent f924aaf commit 675ee77
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_statlab_corr.py
Original file line number Diff line number Diff line change
@@ -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()
File renamed without changes.

0 comments on commit 675ee77

Please sign in to comment.