+
+
+def test_gas_read_adc():
+ sys.modules['RPi'] = mock.Mock()
+ sys.modules['RPi.GPIO'] = mock.Mock()
+ smbus = mock.Mock()
+ smbus.SMBus = SMBusFakeDevice
+ sys.modules['smbus'] = smbus
+ from enviroplus import gas
+ gas._is_setup = False
+
+ gas.enable_adc(True)
+ gas.set_adc_gain(2.048)
+ assert gas.read_adc() == 0.255
+
+
+def test_gas_read_adc_default_gain():
+ sys.modules['RPi'] = mock.Mock()
+ sys.modules['RPi.GPIO'] = mock.Mock()
+ smbus = mock.Mock()
+ smbus.SMBus = SMBusFakeDevice
+ sys.modules['smbus'] = smbus
+ from enviroplus import gas
+ gas._is_setup = False
+
+ gas.enable_adc(True)
+ assert gas.read_adc() == 0.255
+
+
+def test_gas_read_adc_str():
+ sys.modules['RPi'] = mock.Mock()
+ sys.modules['RPi.GPIO'] = mock.Mock()
+ smbus = mock.Mock()
+ smbus.SMBus = SMBusFakeDevice
+ sys.modules['smbus'] = smbus
+ from enviroplus import gas
+ gas._is_setup = False
+
+ gas.enable_adc(True)
+ gas.set_adc_gain(2.048)
+ assert 'ADC' in str(gas.read_all())