Fix test failed in py35 (#23002)
parent
02347df140
commit
ac7f1a7a37
|
@ -45,18 +45,22 @@ class TestDemoPlatform(unittest.TestCase):
|
|||
all_states = self.hass.states.all()
|
||||
assert len(all_states) == NUMBER_OF_DEMO_DEVICES + 1
|
||||
|
||||
# Check a single device's attributes.
|
||||
state_first_entry = all_states[1] # 0 is zone
|
||||
assert abs(
|
||||
state_first_entry.attributes['latitude'] -
|
||||
self.hass.config.latitude
|
||||
) < 1.0
|
||||
assert abs(
|
||||
state_first_entry.attributes['longitude'] -
|
||||
self.hass.config.longitude
|
||||
) < 1.0
|
||||
assert state_first_entry.attributes['unit_of_measurement'] == \
|
||||
DEFAULT_UNIT_OF_MEASUREMENT
|
||||
for state in all_states:
|
||||
# Check a single device's attributes.
|
||||
if state.domain != geo_location.DOMAIN:
|
||||
# ignore home zone state
|
||||
continue
|
||||
assert abs(
|
||||
state.attributes['latitude'] -
|
||||
self.hass.config.latitude
|
||||
) < 1.0
|
||||
assert abs(
|
||||
state.attributes['longitude'] -
|
||||
self.hass.config.longitude
|
||||
) < 1.0
|
||||
assert state.attributes['unit_of_measurement'] == \
|
||||
DEFAULT_UNIT_OF_MEASUREMENT
|
||||
|
||||
# Update (replaces 1 device).
|
||||
fire_time_changed(self.hass, utcnow + DEFAULT_UPDATE_INTERVAL)
|
||||
self.hass.block_till_done()
|
||||
|
|
Loading…
Reference in New Issue