-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
my.location: let takeout provider be in a separate my.location.google…
…; add CI test & enable mypy
- Loading branch information
Showing
7 changed files
with
82 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[submodule "testdata/hpi-testdata"] | ||
path = testdata/hpi-testdata | ||
url = https://github.com/karlicoss/hpi-testdata | ||
[submodule "testdata/track"] | ||
path = testdata/track | ||
url = https://github.com/tajtiattila/track |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,6 @@ class exercise: | |
|
||
class bluemaestro: | ||
export_path: Paths = '' | ||
|
||
class google: | ||
takeout_path: Paths = '' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from pathlib import Path | ||
|
||
from more_itertools import one | ||
|
||
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): | ||
testdata = Path(__file__).absolute().parent.parent / 'testdata' | ||
assert testdata.exists(), testdata | ||
|
||
track = one(testdata.rglob('italy-slovenia-2017-07-29.json')) | ||
|
||
# todo ugh. unnecessary zipping, but at the moment takeout provider doesn't support plain dirs | ||
import zipfile | ||
with zipfile.ZipFile(tmp_path / 'takeout.zip', 'w') as zf: | ||
zf.writestr('Takeout/Location History/Location History.json', track.read_bytes()) | ||
|
||
from my.cfg import config | ||
class user_config: | ||
takeout_path = tmp_path | ||
config.google = user_config # type: ignore | ||
yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters