-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
34 lines (27 loc) · 904 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from shimmer4py import get_kurtosis, get_sd, get_mean
import unittest
import numpy as np
from scipy.stats import kurtosis as kt
class TestShimmerMethods(unittest.TestCase):
def setUp(self):
self.data = np.random.poisson(0.9, (10,))
def test_sd(self):
self.assertAlmostEqual(
np.std(self.data, axis=0), get_sd(self.data, self.data.shape[0]),
msg="STD not within bounds",
delta=1e-6
)
def test_mean(self):
self.assertAlmostEqual(
np.mean(self.data, axis=0), get_mean(self.data),
msg="Mean not within bounds",
delta=1e-6
)
def test_kt(self):
self.assertAlmostEqual(
kt(self.data, fisher=False), get_kurtosis(self.data),
msg="Kurtosis not within bounds",
delta=1e-6
)
if __name__=="__main__":
unittest.main()