Esempio n. 1
0
def test_calculateSOCValues_zero_values():
    velocities = [0, 0, 0]
    elevations = [(0, 0), (0, 0), (0, 0)]
    distances = [0, 0, 0]
    initial_soc = 0

    with pytest.raises(ZeroDivisionError):
        calculateSOCValues(velocities, elevations, distances, initial_soc)
Esempio n. 2
0
def test_calculateSOCValues_initial_soc_non_1():
    velocities = [5, 7, 9, 13, 9.5, 7.5, 5]
    elevations = [(-1, 100), (1, 100), (3, 100), (3, 100), (1, 100), (1, 100),
                  (1.5, 100)]
    distances = [10000, 10000, 20000, 30000, 30000, 30000, 20000]
    initial_soc = 0.9

    expected_result = [
        0.9, 0.8999995851481777, 0.8999991160493324, 0.8999985299598554,
        0.8999992236028236, 0.8999994058571505, 0.8999995157405268,
        0.8999994937072884
    ]

    assert (expected_result == calculateSOCValues(velocities, elevations,
                                                  distances, initial_soc))
Esempio n. 3
0
def test_calculateSOCValues_inconsistent_length_inputs():
    with pytest.raises(IndexError):
        calculateSOCValues([1, 2, 3], [(1, 1)], [1], 1)
        calculateSOCValues([1, 2], [(1, 2), (2, 2), (4, 5)], [1, 2], 1)
Esempio n. 4
0
def test_calculateSOCValues_single_element_inputs():
    with mock.patch("soc.SoCEstimation.CoulombCounter.get_soc",
                    return_value=0.9):
        expected_result = [1, 0.9]
        assert (expected_result == (calculateSOCValues([1], [(1, 1)], [1], 1)))
Esempio n. 5
0
def test_calculateSOCValues_zero_length_inputs():
    with pytest.raises(IndexError):
        calculateSOCValues([], [], [], 1)