コード例 #1
0
def test_convergence_does_not_raise_on_contained_variations():
    analyser = Analyser()

    # Should not raise. What matters in the end is the delta between first and last values.
    analyser.check_temperature_convergence(
        fermenter="f1", temperatures=[20, 21, 18, 17, 17], is_cooling=True, setpoint=0,
    )
コード例 #2
0
def test_convergence_to_zero_does_not_raise():
    analyser = Analyser()
    analyser.check_temperature_convergence(fermenter="f1",
                                           temperatures=[20, 19.5, 18, 17, 17],
                                           is_cooling=True,
                                           setpoint=0,
                                           acceptable_delta=0.5)
コード例 #3
0
def test_steady_temperature_should_not_raise():
    analyser = Analyser()

    # Should not raise.
    analyser.check_temperature_convergence(fermenter="f1",
                                           temperatures=[19, 19, 19, 19, 19],
                                           is_cooling=False,
                                           setpoint=20,
                                           acceptable_delta=0.5)
コード例 #4
0
def test_cold_unit_breaks_during_cc():
    analyser = Analyser()

    # Should raise.
    with raises(Anomaly) as excinfo:
        analyser.check_temperature_convergence(fermenter="f1",
                                               temperatures=[4, 4, 4, 4, 6],
                                               is_cooling=True,
                                               setpoint=0,
                                               acceptable_delta=0.5)
    assert excinfo.value.message == STATE.TEMP_RISING
コード例 #5
0
def test_temperature_decreases_but_should_be_increasing():
    analyser = Analyser()

    # Should raise.
    with raises(Anomaly) as excinfo:
        analyser.check_temperature_convergence(
            fermenter="f1",
            temperatures=[20, 19.5, 19, 19, 19],
            is_cooling=False,
            setpoint=20,
        )
    assert excinfo.value.message == "temperature-falling"
コード例 #6
0
def test_oscillation_around_20():
    analyser = Analyser()

    # Should raise.
    with raises(Anomaly) as excinfo:
        analyser.check_temperature_convergence(
            fermenter="f1",
            temperatures=[19.5, 20, 20.5, 20, 20.5],
            is_cooling=True,
            setpoint=20,
        )
    assert excinfo.value.message == "temperature-rising"
コード例 #7
0
def test_convergence_to_zero_raises():
    analyser = Analyser()

    # Should raise.
    with raises(Anomaly) as excinfo:
        analyser.check_temperature_convergence(
            fermenter="f1",
            temperatures=[20, 20, 20.5, 20.6, 20.7],
            is_cooling=True,
            setpoint=0,
        )
    assert excinfo.value.message == "temperature-rising"
コード例 #8
0
def test_temperature_decreases_but_should_be_increasing():
    analyser = Analyser()

    # Should raise.
    with raises(Anomaly) as excinfo:
        analyser.check_temperature_convergence(
            fermenter="f1",
            temperatures=[20, 19.5, 19, 19, 19],
            is_cooling=False,
            setpoint=20,
            acceptable_delta=0.5)
    assert excinfo.value.message == STATE.TEMP_FALLING
コード例 #9
0
def test_oscillation_around_20():
    analyser = Analyser()

    # Should raise.
    with raises(Anomaly) as excinfo:
        analyser.check_temperature_convergence(
            fermenter="f1",
            temperatures=[19.5, 20, 20.5, 20, 21],
            is_cooling=True,
            setpoint=20,
            acceptable_delta=0.5)
    assert excinfo.value.message == STATE.TEMP_RISING