-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: moved stray tests into tests folder, minor improvements
- Loading branch information
Showing
7 changed files
with
75 additions
and
56 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
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
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,23 @@ | ||
import os | ||
from datetime import datetime, timezone | ||
|
||
from aw_client import ActivityWatchClient | ||
from quantifiedme.load.activitywatch import load_events | ||
|
||
hostname = os.uname().nodename | ||
|
||
|
||
def test_load_events(): | ||
awc = ActivityWatchClient("testloadevents", port=5600, testing=False) | ||
hostname = os.uname().nodename | ||
now = datetime.now(tz=timezone.utc) | ||
today = datetime.combine(now, datetime.min.time(), tzinfo=timezone.utc) | ||
since = today | ||
end = now | ||
events = load_events(awc, hostname, since, end) | ||
assert events | ||
print(len(events)) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_load_events() |
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,29 @@ | ||
import sys | ||
from datetime import datetime | ||
from pathlib import Path | ||
|
||
import pytest | ||
from quantifiedme.load.smartertime import ( | ||
_load_smartertime_events, | ||
convert_csv_to_awbucket, | ||
) | ||
|
||
test_file = Path( | ||
"~/Programming/quantifiedme/data/smartertime/smartertime_export_erb-f3_2022-02-01_efa36e6a.awbucket.json" | ||
).expanduser() | ||
|
||
|
||
@pytest.mark.skipif(not test_file.exists(), reason="test file not found") | ||
def test_load_smartertime_events(): | ||
events = _load_smartertime_events( | ||
datetime(2020, 1, 1), | ||
filepath=test_file, | ||
) | ||
assert len(events) > 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) > 1 and sys.argv[1] == "convert": | ||
assert len(sys.argv) > 2 | ||
filename = sys.argv.pop() | ||
convert_csv_to_awbucket(filename) |
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,11 @@ | ||
from quantifiedme.load.whoop import load_heartrate_df, load_sleep_df | ||
|
||
|
||
def test_load_whoop_heartrate(): | ||
df = load_heartrate_df() | ||
print(df.head()) | ||
|
||
|
||
def test_load_whoop_sleep(): | ||
df = load_sleep_df() | ||
print(df.head()) |