GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( d5fd82...69efa7 )
by Sabiha
03:27 queued 58s
created

test_peak_ratio()   A

Complexity

Conditions 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 13
rs 9.85
c 0
b 0
f 0
cc 1
nop 0
1
"""This module tests the calculation functions."""
2
import numpy as np
3
import pandas as pd
4
from voltcycle import calculations
5
6
7
def test_peak_values():
8
    """This function tests peak_values() function."""
9
    potentials = [0.500, 0.499, 0.498, 0.497]
10
    currents = [7.040, 6.998, 8.256, 8.286]
11
    potentials_d = pd.DataFrame(potentials)
12
    currents_d = pd.DataFrame(currents)
13
14
    assert (isinstance(calculations.peak_values(potentials_d, currents_d),
15
            np.ndarray), "output is not an array")
16
    assert (calculations.peak_values(potentials_d, currents_d)[0]
17
            == 0.498, "array value incorrect for data")
18
    assert (calculations.peak_values(potentials_d, currents_d)[2]
19
            == 0.499, "array value incorrect for data")
20
    assert (calculations.peak_values(potentials_d, currents_d)[1]
21
            == 8.256, "array value incorrect for data")
22
    assert (calculations.peak_values(potentials_d, currents_d)[3]
23
            == 6.998, "array value incorrect for data")
24
25
26
def test_del_potential():
27
    """This function tests the del_potential function."""
28
    potentials = [0.500, 0.498, 0.499, 0.497]
29
    currents = [7.040, 6.998, 8.256, 8.286]
30
    potentials_d = pd.DataFrame(potentials)
31
    currents_d = pd.DataFrame(currents)
32
33
    assert (isinstance(calculations.del_potential(potentials_d, currents_d)
34
                        == np.ndarray), "output is not an array")
35
    assert (calculations.del_potential(potentials_d, currents_d).shape
36
                        == (1, 1), "output shape incorrect")
37
    assert (calculations.del_potential(potentials_d, currents_d).size 
38
                        == 1, "array size incorrect")
39
    (np.testing.assert_almost_equal(calculations.del_potential(potentials_d, currents_d),
40
				    0.001, decimal=3), "value incorrect for data")
41
42
43
def test_half_wave_potential():
44
    """This function tests half_wave_potential() function."""
45
    potentials = [0.500, 0.498, 0.499, 0.497]
46
    currents = [7.040, 6.998, 8.256, 8.286]
47
    potentials_d = pd.DataFrame(potentials)
48
    currents_d = pd.DataFrame(currents)
49
50
    assert (isinstance(calculations.half_wave_potential(potentials_d, currents_d)
51
            == np.ndarray), "output is not an array")
52
    assert (calculations.half_wave_potential(potentials_d, currents_d).size
53
            == 1, "out not correct size")
54
    (np.testing.assert_almost_equal(calculations.half_wave_potential(potentials_d, currents_d),
55
                                    0.0005, decimal=4), "value incorrect for data")
56
57
58
def test_peak_heights():
59
    """This function tests peak_heights() function."""
60
    potentials = [0.500, 0.498, 0.499, 0.497]
61
    currents = [7.040, 6.998, 8.256, 8.286]
62
    potentials_d = pd.DataFrame(potentials)
63
    currents_d = pd.DataFrame(currents)
64
65
    assert (isinstance(calculations.peak_heights(potentials_d, currents_d),
66
            list), "output is not a list")
67
    assert (len(calculations.peak_heights(potentials_d, currents_d))
68
            == 2, "output list is not the correct length")
69
    np.testing.assert_almost_equal(calculations.peak_heights(potentials_d, currents_d)[0],              7.256, decimal=3, err_msg="max peak height incorrect for data")
70
    np.testing.assert_almost_equal(calculations.peak_heights(potentials_d, currents_d)[1],              4.998, decimal=3, err_msg="min peak height incorrect for data")
71
72
73
def test_peak_ratio():
74
    """This function tests peak_ratio() function."""
75
    potentials = [0.500, 0.498, 0.499, 0.497]
76
    currents = [7.040, 6.998, 8.256, 8.286]
77
    potentials_d = pd.DataFrame(potentials)
78
    currents_d = pd.DataFrame(currents)
79
80
    assert (isinstance(calculations.peak_ratio(potentials_d, currents_d))
81
            == np.ndarray, "output is not an array")
82
    assert (len(calculations.peak_ratio(potentials_d, currents_d))
83
            == 1, "output list is not the correct length")
84
    np.testing.assert_almost_equal(calculations.peak_ratio(potentials_d, currents_d),
85
            1.451, decimal=3, err_msg="max peak height incorrect for data")
86