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 ( 612b69...d2389a )
by
unknown
02:06
created

voltcycle.functions_and_tests.test_calculations   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 53
dl 0
loc 74
rs 10
c 0
b 0
f 0
wmc 5

5 Functions

Rating   Name   Duplication   Size   Complexity  
A test_del_potential() 0 12 1
A test_peak_values() 0 13 1
A test_peak_ratio() 0 11 1
A test_peak_heights() 0 12 1
A test_half_wave_potential() 0 11 1
1
import numpy as np
2
import pandas as pd
3
4
5
import calculations
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 type(calculations.peak_values(potentials_d, currents_d)) == np.ndarray, "output is not an array"
15
    assert calculations.peak_values(potentials_d, currents_d)[0] == 0.498, "array value incorrect for data"
16
    assert calculations.peak_values(potentials_d, currents_d)[2] == 0.499, "array value incorrect for data"
17
    assert calculations.peak_values(potentials_d, currents_d)[1] == 8.256, "array value incorrect for data"
18
    assert calculations.peak_values(potentials_d, currents_d)[3] == 6.998, "array value incorrect for data"
19
    return
20
21
22
def test_del_potential():
23
    """This function tests the del_potential function."""
24
    potentials = [0.500, 0.498, 0.499, 0.497]
25
    currents = [7.040, 6.998, 8.256, 8.286]
26
    potentials_d = pd.DataFrame(potentials)
27
    currents_d = pd.DataFrame(currents)
28
29
    assert type(calculations.del_potential(potentials_d, currents_d)) == np.ndarray, "output is not an array"
30
    assert calculations.del_potential(potentials_d, currents_d).shape == (1,), "output shape incorrect"
31
    assert calculations.del_potential(potentials_d, currents_d).size == 1, "array size incorrect"
32
    np.testing.assert_almost_equal(calculations.del_potential(potentials_d, currents_d), 0.001, decimal=3), "value incorrect for data"
33
    return
34
35
36
def test_half_wave_potential():
37
    """This function tests half_wave_potential() function."""
38
    potentials = [0.500, 0.498, 0.499, 0.497]
39
    currents = [7.040, 6.998, 8.256, 8.286]
40
    potentials_d = pd.DataFrame(potentials)
41
    currents_d = pd.DataFrame(currents)
42
43
    assert type(calculations.half_wave_potential(potentials_d, currents_d)) == np.ndarray, "output is not an array"
44
    assert calculations.half_wave_potential(potentials_d, currents_d).size == 1, "out not correct size"
45
    np.testing.assert_almost_equal(calculations.half_wave_potential(potentials_d, currents_d), 0.0005, decimal=4), "value incorrect for data"
46
    return
47
48
49
def test_peak_heights():
50
    """This function tests peak_heights() function."""
51
    potentials = [0.500, 0.498, 0.499, 0.497]
52
    currents = [7.040, 6.998, 8.256, 8.286]
53
    potentials_d = pd.DataFrame(potentials)
54
    currents_d = pd.DataFrame(currents)
55
56
    assert type(calculations.peak_heights(potentials_d, currents_d)) == list, "output is not a list"
57
    assert len(calculations.peak_heights(potentials_d, currents_d)) == 2, "output list is not the correct length"
58
    np.testing.assert_almost_equal(calculations.peak_heights(potentials_d, currents_d)[0], 7.256, decimal=3), "max peak height incorrect for data"
59
    np.testing.assert_almost_equal(calculations.peak_heights(potentials_d, currents_d)[1], 4.998, decimal=3), "min peak height incorrect for data"
60
    return
61
62
63
def test_peak_ratio():
64
    """This function tests peak_ratio() function."""
65
    potentials = [0.500, 0.498, 0.499, 0.497]
66
    currents = [7.040, 6.998, 8.256, 8.286]
67
    potentials_d = pd.DataFrame(potentials)
68
    currents_d = pd.DataFrame(currents)
69
70
    assert type(calculations.peak_ratio(potentials_d, currents_d)) == np.ndarray, "output is not an array"
71
    assert len(calculations.peak_ratio(potentials_d, currents_d)) == 1, "output list is not the correct length"
72
    np.testing.assert_almost_equal(calculations.peak_ratio(potentials_d, currents_d), 1.451, decimal=3), "max peak height incorrect for data"
73
    return
74