def test_get_summary(mocker): assert 0x2C000 == 0b101100000000000000 utils.mock_cmd_output("0x2C000", mocker) # sets are equal even regardless of the order assert throttled.get_summary() == { "under-voltage", "arm frequency capped", "soft temperature limit", }
def test_get(mocker): assert 0x2C009 == 0b101100000000001001 utils.mock_cmd_output("0x2C009", mocker) assert throttled.get() == "1011:1001"
def test_get_temperature(mocker): utils.mock_cmd_output("58.9'C", mocker) assert pytest.approx(get_temperature(), abs=0.001) == 58.9
def test_value_get_avg(mocker, test_input, expected): utils.mock_cmd_output("58.9'C", mocker) value = Value(getter_mock) # any getter is fine value.all = test_input assert pytest.approx(sum(value.all) / len(value.all), abs=0.001) == expected
def test_get_clock(mocker): utils.mock_cmd_output("600117184", mocker) assert get_clock() == 600
def test_get_voltage(mocker): utils.mock_cmd_output("0.8438V", mocker) assert pytest.approx(get_voltage(), abs=0.0001) == 0.8438