HPI/tests/location.py
seanbreckenridge 98b086f746
location fallback (#263)
see https://github.com/karlicoss/HPI/issues/262

* move home to fallback/via_home.py
* move via_ip to fallback
* add fallback model
* add stub via_ip file
* add fallback_locations for via_ip
* use protocol for locations
* estimate_from helper, via_home estimator, all.py
* via_home: add accuracy, cache history
* add datasources to gpslogger/google_takeout
* tz/via_location.py: update import to fallback
* denylist docs/installation instructions
* tz.via_location: let user customize cachew refresh time
* add via_ip.estimate_location using binary search
* use estimate_location in via_home.get_location
* tests: add gpslogger to location config stub
* tests: install tz related libs in test env
* tz: add regression test for broken windows dates

* vendorize bisect_left from python src
doesnt have a 'key' parameter till python3.10
2023-02-28 04:30:06 +00:00

28 lines
665 B
Python

from pathlib import Path
import pytest # type: ignore
def test() -> None:
from my.location.google import locations
locs = list(locations())
assert len(locs) == 3810
last = locs[-1]
assert last.dt.strftime('%Y%m%d %H:%M:%S') == '20170802 13:01:56' # should be utc
# todo approx
assert last.lat == 46.5515350
assert last.lon == 16.4742742
# todo check altitude
@pytest.fixture(autouse=True)
def prepare(tmp_path: Path):
from .shared_config import temp_config
user_config = temp_config(tmp_path)
import my.core.cfg as C
with C.tmp_config() as config:
config.google = user_config.google
yield