1 def test_gas_setup(GPIO
, smbus
):
2 from enviroplus
import gas
8 def test_gas_read_all(GPIO
, smbus
):
9 from enviroplus
import gas
11 result
= gas
.read_all()
13 assert type(result
.oxidising
) == float
14 assert int(result
.oxidising
) == 16641
16 assert type(result
.reducing
) == float
17 assert int(result
.reducing
) == 16727
19 assert type(result
.nh3
) == float
20 assert int(result
.nh3
) == 16813
22 assert "Oxidising" in str(result
)
25 def test_gas_read_each(GPIO
, smbus
):
26 from enviroplus
import gas
29 assert int(gas
.read_oxidising()) == 16641
30 assert int(gas
.read_reducing()) == 16727
31 assert int(gas
.read_nh3()) == 16813
34 def test_gas_read_adc(GPIO
, smbus
):
35 from enviroplus
import gas
39 gas
.set_adc_gain(2.048)
40 assert gas
.read_adc() == 0.255
43 def test_gas_read_adc_default_gain(GPIO
, smbus
):
44 from enviroplus
import gas
48 gas
.set_adc_gain(gas
.MICS6814_GAIN
)
49 assert gas
.read_adc() == 0.765
52 def test_gas_read_adc_str(GPIO
, smbus
):
53 from enviroplus
import gas
57 gas
.set_adc_gain(2.048)
58 assert 'ADC' in str(gas
.read_all())
61 def test_gas_cleanup(GPIO
, smbus
):
62 from enviroplus
import gas
66 GPIO
.output
.assert_called_with(gas
.MICS6814_HEATER_PIN
, 0)