Geo Location -> Geolocation (class names and unit test comments) (#19877)
* fixed geolocation naming in class names * fixed geolocation naming in comments in unit test
This commit is contained in:
parent
f73bda1218
commit
6d3343e4d1
8 changed files with 16 additions and 16 deletions
|
@ -35,7 +35,7 @@ async def async_setup(hass, config):
|
|||
return True
|
||||
|
||||
|
||||
class GeoLocationEvent(Entity):
|
||||
class GeolocationEvent(Entity):
|
||||
"""This represents an external event with an associated geolocation."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -10,7 +10,7 @@ from math import cos, pi, radians, sin
|
|||
import random
|
||||
from typing import Optional
|
||||
|
||||
from homeassistant.components.geo_location import GeoLocationEvent
|
||||
from homeassistant.components.geo_location import GeolocationEvent
|
||||
from homeassistant.helpers.event import track_time_interval
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -62,7 +62,7 @@ class DemoManager:
|
|||
cos(radians(home_latitude))
|
||||
|
||||
event_name = random.choice(EVENT_NAMES)
|
||||
return DemoGeoLocationEvent(event_name, radius_in_km, latitude,
|
||||
return DemoGeolocationEvent(event_name, radius_in_km, latitude,
|
||||
longitude, DEFAULT_UNIT_OF_MEASUREMENT)
|
||||
|
||||
def _init_regular_updates(self):
|
||||
|
@ -90,7 +90,7 @@ class DemoManager:
|
|||
self._add_entities(new_devices)
|
||||
|
||||
|
||||
class DemoGeoLocationEvent(GeoLocationEvent):
|
||||
class DemoGeolocationEvent(GeolocationEvent):
|
||||
"""This represents a demo geolocation event."""
|
||||
|
||||
def __init__(self, name, distance, latitude, longitude,
|
||||
|
|
|
@ -11,7 +11,7 @@ from typing import Optional
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.geo_location import (
|
||||
PLATFORM_SCHEMA, GeoLocationEvent)
|
||||
PLATFORM_SCHEMA, GeolocationEvent)
|
||||
from homeassistant.const import (
|
||||
CONF_RADIUS, CONF_SCAN_INTERVAL, CONF_URL, EVENT_HOMEASSISTANT_START,
|
||||
CONF_LATITUDE, CONF_LONGITUDE)
|
||||
|
@ -108,7 +108,7 @@ class GeoJsonFeedEntityManager:
|
|||
dispatcher_send(self._hass, SIGNAL_DELETE_ENTITY.format(external_id))
|
||||
|
||||
|
||||
class GeoJsonLocationEvent(GeoLocationEvent):
|
||||
class GeoJsonLocationEvent(GeolocationEvent):
|
||||
"""This represents an external event with GeoJSON data."""
|
||||
|
||||
def __init__(self, feed_manager, external_id):
|
||||
|
|
|
@ -11,7 +11,7 @@ from typing import Optional
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.geo_location import (
|
||||
PLATFORM_SCHEMA, GeoLocationEvent)
|
||||
PLATFORM_SCHEMA, GeolocationEvent)
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION, ATTR_LOCATION, CONF_RADIUS, CONF_SCAN_INTERVAL,
|
||||
EVENT_HOMEASSISTANT_START, CONF_LATITUDE, CONF_LONGITUDE)
|
||||
|
@ -129,7 +129,7 @@ class NswRuralFireServiceFeedEntityManager:
|
|||
dispatcher_send(self._hass, SIGNAL_DELETE_ENTITY.format(external_id))
|
||||
|
||||
|
||||
class NswRuralFireServiceLocationEvent(GeoLocationEvent):
|
||||
class NswRuralFireServiceLocationEvent(GeolocationEvent):
|
||||
"""This represents an external event with NSW Rural Fire Service data."""
|
||||
|
||||
def __init__(self, feed_manager, external_id):
|
||||
|
|
|
@ -11,7 +11,7 @@ from typing import Optional
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.geo_location import (
|
||||
PLATFORM_SCHEMA, GeoLocationEvent)
|
||||
PLATFORM_SCHEMA, GeolocationEvent)
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION, CONF_RADIUS, CONF_SCAN_INTERVAL,
|
||||
EVENT_HOMEASSISTANT_START, CONF_LATITUDE, CONF_LONGITUDE)
|
||||
|
@ -148,7 +148,7 @@ class UsgsEarthquakesFeedEntityManager:
|
|||
dispatcher_send(self._hass, SIGNAL_DELETE_ENTITY.format(external_id))
|
||||
|
||||
|
||||
class UsgsEarthquakesEvent(GeoLocationEvent):
|
||||
class UsgsEarthquakesEvent(GeolocationEvent):
|
||||
"""This represents an external event with USGS Earthquake data."""
|
||||
|
||||
def __init__(self, feed_manager, external_id):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""The tests for the geo location trigger."""
|
||||
"""The tests for the geolocation trigger."""
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import automation, zone
|
||||
|
|
|
@ -39,7 +39,7 @@ class TestDemoPlatform(unittest.TestCase):
|
|||
with assert_setup_component(1, geo_location.DOMAIN):
|
||||
assert setup_component(self.hass, geo_location.DOMAIN, CONFIG)
|
||||
|
||||
# In this test, only entities of the geo location domain have been
|
||||
# In this test, only entities of the geolocation domain have been
|
||||
# generated.
|
||||
all_states = self.hass.states.all()
|
||||
assert len(all_states) == NUMBER_OF_DEMO_DEVICES
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""The tests for the geo location component."""
|
||||
"""The tests for the geolocation component."""
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import geo_location
|
||||
from homeassistant.components.geo_location import GeoLocationEvent
|
||||
from homeassistant.components.geo_location import GeolocationEvent
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
|
@ -13,8 +13,8 @@ async def test_setup_component(hass):
|
|||
|
||||
|
||||
async def test_event(hass):
|
||||
"""Simple test of the geo location event class."""
|
||||
entity = GeoLocationEvent()
|
||||
"""Simple test of the geolocation event class."""
|
||||
entity = GeolocationEvent()
|
||||
|
||||
assert entity.state is None
|
||||
assert entity.distance is None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue