'Test temperature sensor.'

@patch('pmsensor.co2sensor.read_mh_z19_with_temperature', return_value=(1000, 24))
def test_temperature_sensor(self, mock_function):

    from pmsensor import co2sensor
    client = mhz19.MHZClient(co2sensor, 'test.serial')
    sensor = mhz19.MHZ19Sensor(client, mhz19.SENSOR_TEMPERATURE, None, 'name')
    sensor.update()
    self.assertEqual('name:    Temperature', sensor.name)
    self.assertEqual(24, sensor.state)
    self.assertEqual('\xc2\xb0C', sensor.unit_of_measurement)
    self.assertTrue(sensor.should_poll)
    self.assertEqual({'co2_concentration': 1000}, sensor.device_state_attributes)
