-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
55 lines (38 loc) · 1.56 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Juan B Cabral
# License: BSD-3-Clause
# Full Text: https://github.com/leliel12/pert/blob/master/LICENSE
# =============================================================================
# DOCS
# =============================================================================
"""Pert testing"""
# =============================================================================
# IMPORTS
# =============================================================================
import numpy as np
import pert
# =============================================================================
# CUSTOM STRATEGIE
# =============================================================================
class TestCasePert:
def test_expect(self):
o, p, m = 1, 2, 1
result = pert.expect(o, p, m)
np.testing.assert_almost_equal(result, 1.1666, decimal=4)
def test_std(self):
o, p = 1, 2
result = pert.std(o, p)
np.testing.assert_almost_equal(result, 0.1666, decimal=4)
def test_var(self):
o, p = 1, 2
result = pert.var(o, p)
np.testing.assert_almost_equal(result, 0.1666 ** 2, decimal=4)
def test_estimate(self):
o = [1, 2, 3, 4, 5]
p = [3, 6, 9, 16, 25]
m = [1, 3, 7, 12, 10]
r68, r95, r99 = pert.estimate(o, p, m)
np.testing.assert_almost_equal(r68, [27., 49.], decimal=4)
np.testing.assert_almost_equal(r95, [19.6667, 49.], decimal=4)
np.testing.assert_almost_equal(r99, [12.3333, 56.3333], decimal=4)