'Test for different unit of measurement.'

def test_different_unit_of_measurement(self):

    config = {'sensor': {'platform': 'min_max', 'name': 'test', 'type': 'mean', 'entity_ids': ['sensor.test_1', 'sensor.test_2', 'sensor.test_3']}}
    assert setup_component(self.hass, 'sensor', config)
    entity_ids = config['sensor']['entity_ids']
    self.hass.states.set(entity_ids[0], self.values[0], {ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS})
    self.hass.block_till_done()
    state = self.hass.states.get('sensor.test')
    self.assertEqual(str(float(self.values[0])), state.state)
    self.assertEqual('\xc2\xb0C', state.attributes.get('unit_of_measurement'))
    self.hass.states.set(entity_ids[1], self.values[1], {ATTR_UNIT_OF_MEASUREMENT: TEMP_FAHRENHEIT})
    self.hass.block_till_done()
    state = self.hass.states.get('sensor.test')
    self.assertEqual(STATE_UNKNOWN, state.state)
    self.assertEqual('ERR', state.attributes.get('unit_of_measurement'))
    self.hass.states.set(entity_ids[2], self.values[2], {ATTR_UNIT_OF_MEASUREMENT: '%'})
    self.hass.block_till_done()
    state = self.hass.states.get('sensor.test')
    self.assertEqual(STATE_UNKNOWN, state.state)
    self.assertEqual('ERR', state.attributes.get('unit_of_measurement'))
