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