repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
matin/garth | from datetime import date
from unittest.mock import MagicMock
import pytest
from garth import BodyBatteryData, DailyBodyBatteryStress
from garth.http import Client
def test_body_battery_data_get_api_error():
"""Test handling of API errors."""
mock_client = MagicMock()
mock_client.connectapi.side_effect =... | [] | assert | collection | tests/data/test_body_battery_data.py | test_body_battery_data_get_api_error | 171 | null | |
matin/garth | from datetime import date, datetime
import pytest
from freezegun import freeze_time
from garth import DailyHydration
from garth.http import Client
from garth.stats.hydration import HydrationLogEntry
@pytest.mark.vcr
def test_daily_hydration_log(authed_client: Client):
timestamp = datetime(2026, 1, 9, 15, 30, 0)
... | 1000.0 | assert | numeric_literal | tests/stats/test_hydration.py | test_daily_hydration_log | 28 | null | |
matin/garth | import time
import pytest
from garth import sso
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
def test_get_title():
html = """
<html>
<head>
<title>Success</title>
</head>
<body>
<h1>Success</h1>
... | "Success" | assert | string_literal | tests/test_sso.py | test_get_title | 171 | null | |
matin/garth | from datetime import date
from unittest.mock import MagicMock
import pytest
from garth import BodyBatteryData, DailyBodyBatteryStress
from garth.http import Client
@pytest.mark.vcr
def test_body_battery_data_list(authed_client: Client):
days = 3
end = date(2023, 7, 20)
body_battery_data = BodyBatteryData... | 0 | assert | numeric_literal | tests/data/test_body_battery_data.py | test_body_battery_data_list | 52 | null | |
matin/garth | from dataclasses import dataclass
from datetime import date, datetime
from garth.utils import (
asdict,
camel_to_snake,
camel_to_snake_dict,
format_end_date,
remove_dto_suffix,
remove_dto_suffix_from_dict,
)
def test_remove_dto_suffix():
# Keys ending with _dto should have suffix removed
... | "dto_activity" | assert | string_literal | tests/test_utils.py | test_remove_dto_suffix | 79 | null | |
matin/garth | from datetime import date
import pytest
from garth import MorningTrainingReadinessData
from garth.http import Client
@pytest.mark.vcr
def test_morning_training_readiness_data_list(authed_client: Client):
days = 2
end = date(2025, 7, 7)
morning_training_readiness = MorningTrainingReadinessData.list(
... | end | assert | variable | tests/data/test_morning_training_readiness.py | test_morning_training_readiness_data_list | 34 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailyIntensityMinutes, WeeklyIntensityMinutes
from garth.http import Client
@pytest.mark.vcr
def test_weekly_intensity_minutes(authed_client: Client):
end = date(2023, 7, 20)
weeks = 12
weekly_im = WeeklyIntensityMinutes.list(end, weeks, client=au... | end.isocalendar()[1] | assert | func_call | tests/stats/test_intensity_minutes.py | test_weekly_intensity_minutes | 24 | null | |
matin/garth | from datetime import date
import pytest
from garth import FitnessActivity
from garth.http import Client
@pytest.mark.vcr
def test_fitness_activity_list(authed_client: Client):
activities = FitnessActivity.list(
date(2026, 1, 12), days=7, client=authed_client
)
assert len(activities) > 0
# Ch... | None | assert | none_literal | tests/data/test_fitness_stats.py | test_fitness_activity_list | 23 | null | |
matin/garth | import tempfile
import time
from typing import Any, cast
import pytest
from requests.adapters import HTTPAdapter
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
def test_configure_proxies(client: Client):
assert client.ses... | {} | assert | collection | tests/test_http.py | test_configure_proxies | 133 | null | |
matin/garth | from datetime import date, datetime
import pytest
from freezegun import freeze_time
from garth import DailyHydration
from garth.http import Client
from garth.stats.hydration import HydrationLogEntry
@pytest.mark.vcr
@freeze_time("2026-01-09 15:30:00")
def test_daily_hydration_log_default_timestamp(authed_client: Cli... | datetime(2026, 1, 9, 15, 30, 0) | assert | func_call | tests/stats/test_hydration.py | test_daily_hydration_log_default_timestamp | 38 | null | |
matin/garth | from datetime import date
import pytest
from garth import HRVData
from garth.http import Client
@pytest.mark.vcr
def test_hrv_data_list(authed_client: Client):
days = 2
end = date(2023, 7, 20)
hrv_data = HRVData.list(end, days, client=authed_client, max_workers=1)
assert len(hrv_data) == | days | assert | variable | tests/data/test_hrv_data.py | test_hrv_data_list | 24 | null | |
matin/garth | from datetime import date
import pytest
from garth import SleepData
from garth.http import Client
@pytest.mark.vcr
def test_sleep_data_list(authed_client: Client):
end = date(2021, 7, 20)
days = 20
sleep_data = SleepData.list(end, days, client=authed_client, max_workers=1)
assert sleep_data[-1].daily... | days | assert | variable | tests/data/test_sleep_data.py | test_sleep_data_list | 24 | null | |
matin/garth | from datetime import date
import pytest
from garth import (
DailyTrainingStatus,
MonthlyTrainingStatus,
WeeklyTrainingStatus,
)
from garth.http import Client
@pytest.mark.vcr
def test_weekly_training_status(authed_client: Client):
end = date(2025, 6, 11)
weeks = 4 # Use a smaller, more reasonabl... | 0 | assert | numeric_literal | tests/stats/test_training_status.py | test_weekly_training_status | 38 | null | |
matin/garth | from datetime import date, datetime, timedelta, timezone
import pytest
from garth.data import WeightData
from garth.http import Client
@pytest.mark.vcr
def test_weight_data_list_single_day(authed_client: Client):
end = date(2025, 6, 14)
weight_data = WeightData.list(end, client=authed_client)
assert len(... | "MANUAL" | assert | string_literal | tests/data/test_weight_data.py | test_weight_data_list_single_day | 97 | null | |
matin/garth | import time
from garth.auth_tokens import OAuth1Token, OAuth2Token
def test_str(oauth2_token: OAuth2Token):
assert str(oauth2_token) == | "Bearer bar" | assert | string_literal | tests/test_auth_tokens.py | test_str | 17 | null | |
matin/garth | from dataclasses import dataclass
from datetime import date, datetime
from garth.utils import (
asdict,
camel_to_snake,
camel_to_snake_dict,
format_end_date,
remove_dto_suffix,
remove_dto_suffix_from_dict,
)
def test_camel_to_snake_dict():
assert camel_to_snake_dict({"hiThereHuman": "hi"}... | { "hi_there_human": "hi" } | assert | collection | tests/test_utils.py | test_camel_to_snake_dict | 19 | null | |
matin/garth | import time
import pytest
from garth import sso
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
@pytest.mark.vcr
def test_login_mfa_fail(client: Client):
with pytest.raises( | GarthException) | pytest.raises | variable | tests/test_sso.py | test_login_mfa_fail | 69 | null | |
matin/garth | from unittest.mock import MagicMock
import pytest
from requests import Session
from garth.http import Client
from garth.telemetry import (
REDACTED,
Telemetry,
_scrubbing_callback,
sanitize,
sanitize_cookie,
sanitize_headers,
)
def test_telemetry_defaults():
t = Telemetry()
assert t.s... | None | assert | none_literal | tests/test_telemetry.py | test_telemetry_defaults | 52 | null | |
matin/garth | from datetime import date, datetime, timedelta, timezone
import pytest
from garth.data import WeightData
from garth.http import Client
@pytest.mark.vcr
def test_weight_data_list_single_day(authed_client: Client):
end = date(2025, 6, 14)
weight_data = WeightData.list(end, client=authed_client)
assert len... | 2 | assert | numeric_literal | tests/data/test_weight_data.py | test_weight_data_list_single_day | 94 | null | |
matin/garth | from datetime import date
import pytest
from garth import TrainingReadinessData
from garth.http import Client
@pytest.mark.vcr
def test_training_readiness_data_get(authed_client: Client):
entries = TrainingReadinessData.get("2025-07-07", client=authed_client)
assert entries is not | None | assert | none_literal | tests/data/test_training_readiness.py | test_training_readiness_data_get | 12 | null | |
matin/garth | from dataclasses import dataclass
from datetime import date, datetime
from garth.utils import (
asdict,
camel_to_snake,
camel_to_snake_dict,
format_end_date,
remove_dto_suffix,
remove_dto_suffix_from_dict,
)
def test_camel_to_snake():
assert camel_to_snake("hiThereHuman") == | "hi_there_human" | assert | string_literal | tests/test_utils.py | test_camel_to_snake | 15 | null | |
matin/garth | from datetime import date
import pytest
from garth import SleepData
from garth.http import Client
@pytest.mark.vcr
def test_sleep_data_list(authed_client: Client):
end = date(2021, 7, 20)
days = 20
sleep_data = SleepData.list(end, days, client=authed_client, max_workers=1)
assert sleep_data[-1].dail... | end | assert | variable | tests/data/test_sleep_data.py | test_sleep_data_list | 23 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailyHRV
from garth.http import Client
@pytest.mark.vcr
def test_daily_hrv(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_hrv = DailyHRV.list(end, days, client=authed_client)
assert daily_hrv[-1].calendar_date == | end | assert | variable | tests/stats/test_hrv.py | test_daily_hrv | 14 | null | |
matin/garth | import pytest
from garth import Activity
from garth.http import Client
@pytest.mark.vcr
def test_activity_list(authed_client: Client):
activities = Activity.list(limit=3, client=authed_client)
assert len(activities) == | 3 | assert | numeric_literal | tests/data/test_activity.py | test_activity_list | 10 | null | |
matin/garth | from datetime import date, datetime, timedelta, timezone
import pytest
from garth.data import WeightData
from garth.http import Client
@pytest.mark.vcr
def test_weight_data_list(authed_client: Client):
end = date(2025, 6, 15)
days = 15
weight_data = WeightData.list(end, days, client=authed_client)
#... | 4 | assert | numeric_literal | tests/data/test_weight_data.py | test_weight_data_list | 82 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailySleep
from garth.http import Client
@pytest.mark.vcr
def test_daily_sleep(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_sleep = DailySleep.list(end, days, client=authed_client)
assert daily_sleep[-1].calendar_date == end... | days | assert | variable | tests/stats/test_sleep_stats.py | test_daily_sleep | 15 | null | |
matin/garth | from datetime import date
from unittest.mock import MagicMock
import pytest
from garth import BodyBatteryData, DailyBodyBatteryStress
from garth.http import Client
def test_body_battery_data_get_missing_event_data():
"""Test handling of items with missing event data."""
mock_client = MagicMock()
mock_cli... | None | assert | none_literal | tests/data/test_body_battery_data.py | test_body_battery_data_get_missing_event_data | 192 | null | |
matin/garth | from datetime import date, timedelta
import pytest
from garth import DailySteps, WeeklySteps
from garth.http import Client
@pytest.mark.vcr
def test_weekly_steps(authed_client: Client):
end = date(2023, 7, 20)
weeks = 52
weekly_steps = WeeklySteps.list(end, weeks, client=authed_client)
assert len(we... | weeks | assert | variable | tests/stats/test_steps.py | test_weekly_steps | 23 | null | |
matin/garth | from datetime import date
import pytest
from garth import TrainingReadinessData
from garth.http import Client
@pytest.mark.vcr
def test_training_readiness_data_get(authed_client: Client):
entries = TrainingReadinessData.get("2025-07-07", client=authed_client)
assert entries is not None
assert len(entries... | True | assert | bool_literal | tests/data/test_training_readiness.py | test_training_readiness_data_get | 26 | null | |
matin/garth | from datetime import date
from unittest.mock import MagicMock
import pytest
from garth import BodyBatteryData, DailyBodyBatteryStress
from garth.http import Client
@pytest.mark.vcr
def test_daily_body_battery_stress_list(authed_client: Client):
days = 3
end = date(2023, 7, 20)
# Use max_workers=1 to avoi... | days | assert | variable | tests/data/test_body_battery_data.py | test_daily_body_battery_stress_list | 135 | null | |
matin/garth | from datetime import date, datetime
import pytest
from freezegun import freeze_time
from garth import DailyHydration
from garth.http import Client
from garth.stats.hydration import HydrationLogEntry
@pytest.mark.vcr
def test_daily_hydration(authed_client: Client):
end = date(2024, 6, 29)
daily_hydration = Da... | end | assert | variable | tests/stats/test_hydration.py | test_daily_hydration | 15 | null | |
matin/garth | from datetime import date, datetime, timedelta, timezone
import pytest
from garth.data import WeightData
from garth.http import Client
@pytest.mark.vcr
def test_weight_data_timestamps_preserved(authed_client: Client):
"""Test that raw timestamps are preserved and datetimes computed.
The API returns:
- t... | expected_utc | assert | variable | tests/data/test_weight_data.py | test_weight_data_timestamps_preserved | 36 | null | |
matin/garth | from unittest.mock import MagicMock
import pytest
from requests import Session
from garth.http import Client
from garth.telemetry import (
REDACTED,
Telemetry,
_scrubbing_callback,
sanitize,
sanitize_cookie,
sanitize_headers,
)
@pytest.mark.vcr
def test_telemetry_enabled_request(authed_client... | 1 | assert | numeric_literal | tests/test_telemetry.py | test_telemetry_enabled_request | 92 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailyIntensityMinutes, WeeklyIntensityMinutes
from garth.http import Client
@pytest.mark.vcr
def test_daily_intensity_minutes(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_im = DailyIntensityMinutes.list(end, days, client=authed_... | days | assert | variable | tests/stats/test_intensity_minutes.py | test_daily_intensity_minutes | 15 | null | |
matin/garth | import tempfile
import time
from typing import Any, cast
import pytest
from requests.adapters import HTTPAdapter
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
@pytest.mark.vcr
def test_connectapi(authed_client: Client):
s... | 1 | assert | numeric_literal | tests/test_http.py | test_connectapi | 258 | null | |
matin/garth | from datetime import date, timedelta
import pytest
from garth import DailyStress, WeeklyStress
from garth.http import Client
@pytest.mark.vcr
def test_weekly_stress(authed_client: Client):
end = date(2023, 7, 20)
weeks = 52
weekly_stress = WeeklyStress.list(end, weeks, client=authed_client)
assert l... | weeks | assert | variable | tests/stats/test_stress.py | test_weekly_stress | 31 | null | |
matin/garth | import time
import pytest
from garth import sso
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
@pytest.mark.vcr
def test_login_email_password_fail(client: Client):
with pytest.raises( | GarthHTTPError) | pytest.raises | variable | tests/test_sso.py | test_login_email_password_fail | 13 | null | |
matin/garth | from datetime import date
import pytest
from garth import HRVData
from garth.http import Client
@pytest.mark.vcr
def test_hrv_data_list(authed_client: Client):
days = 2
end = date(2023, 7, 20)
hrv_data = HRVData.list(end, days, client=authed_client, max_workers=1)
assert len(hrv_data) == days
as... | end | assert | variable | tests/data/test_hrv_data.py | test_hrv_data_list | 25 | null | |
matin/garth | from datetime import date
import pytest
from garth import MorningTrainingReadinessData
from garth.http import Client
@pytest.mark.vcr
def test_morning_training_readiness_data_get(authed_client: Client):
morning_training_readiness_data = MorningTrainingReadinessData.get(
"2025-07-07", client=authed_client... | date(2025, 7, 7) | assert | func_call | tests/data/test_morning_training_readiness.py | test_morning_training_readiness_data_get | 15 | null | |
matin/garth | from datetime import date, datetime
import pytest
from freezegun import freeze_time
from garth import DailyHydration
from garth.http import Client
from garth.stats.hydration import HydrationLogEntry
@pytest.mark.vcr
def test_daily_hydration(authed_client: Client):
end = date(2024, 6, 29)
daily_hydration = Da... | 2800.0 | assert | numeric_literal | tests/stats/test_hydration.py | test_daily_hydration | 17 | null | |
matin/garth | import tempfile
import time
from typing import Any, cast
import pytest
from requests.adapters import HTTPAdapter
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
def test_configure_timeout(client: Client):
assert client.tim... | 10 | assert | numeric_literal | tests/test_http.py | test_configure_timeout | 146 | null | |
matin/garth | from unittest.mock import MagicMock
import pytest
from requests import Session
from garth.http import Client
from garth.telemetry import (
REDACTED,
Telemetry,
_scrubbing_callback,
sanitize,
sanitize_cookie,
sanitize_headers,
)
def test_response_hook_disabled():
"""Test session response h... | 0 | assert | numeric_literal | tests/test_telemetry.py | test_response_hook_disabled | 266 | null | |
matin/garth | import time
import pytest
from garth import sso
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
@pytest.mark.vcr
def test_exchange(authed_client: Client):
assert authed_client.oauth1_token and isinstance(
authed_cli... | oauth2_token | assert | variable | tests/test_sso.py | test_exchange | 129 | null | |
matin/garth | import tempfile
import time
from typing import Any, cast
import pytest
from requests.adapters import HTTPAdapter
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
def test_configure_oauth2_token(client: Client, oauth2_token: OAut... | None | assert | none_literal | tests/test_http.py | test_configure_oauth2_token | 121 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailySleepData
from garth.http import Client
@pytest.mark.vcr
def test_daily_sleep_data_list(authed_client: Client):
days = 2
end = date(2025, 7, 7)
data_list = DailySleepData.list(
end, days, client=authed_client, max_workers=1
)
... | days | assert | variable | tests/data/test_daily_sleep_data.py | test_daily_sleep_data_list | 46 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailyIntensityMinutes, WeeklyIntensityMinutes
from garth.http import Client
@pytest.mark.vcr
def test_daily_intensity_minutes(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_im = DailyIntensityMinutes.list(end, days, client=authed_... | end | assert | variable | tests/stats/test_intensity_minutes.py | test_daily_intensity_minutes | 14 | null | |
matin/garth | from datetime import date
import pytest
from garth import HRVData
from garth.http import Client
@pytest.mark.vcr
def test_hrv_data_get(authed_client: Client):
hrv_data = HRVData.get("2023-07-20", client=authed_client)
assert hrv_data
assert hrv_data.user_profile_pk
assert hrv_data.hrv_summary.calend... | date(2023, 7, 20) | assert | func_call | tests/data/test_hrv_data.py | test_hrv_data_get | 14 | null | |
matin/garth | import pytest
from garth import Activity
from garth.http import Client
@pytest.mark.vcr
def test_activity_get(authed_client: Client):
# First get an activity ID from the list
activities = Activity.list(limit=1, client=authed_client)
assert len(activities) == 1
activity_id = activities[0].activity_id
... | None | assert | none_literal | tests/data/test_activity.py | test_activity_get | 32 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailyIntensityMinutes, WeeklyIntensityMinutes
from garth.http import Client
@pytest.mark.vcr
def test_weekly_intensity_minutes(authed_client: Client):
end = date(2023, 7, 20)
weeks = 12
weekly_im = WeeklyIntensityMinutes.list(end, weeks, client=au... | weeks | assert | variable | tests/stats/test_intensity_minutes.py | test_weekly_intensity_minutes | 23 | null | |
matin/garth | import pytest
from garth import Activity
from garth.http import Client
@pytest.mark.vcr
def test_activity_get(authed_client: Client):
# First get an activity ID from the list
activities = Activity.list(limit=1, client=authed_client)
assert len(activities) == | 1 | assert | numeric_literal | tests/data/test_activity.py | test_activity_get | 22 | null | |
matin/garth | from dataclasses import dataclass
from datetime import date, datetime
from garth.utils import (
asdict,
camel_to_snake,
camel_to_snake_dict,
format_end_date,
remove_dto_suffix,
remove_dto_suffix_from_dict,
)
def test_remove_dto_suffix():
# Keys ending with _dto should have suffix removed
... | "summary" | assert | string_literal | tests/test_utils.py | test_remove_dto_suffix | 73 | null | |
matin/garth | import tempfile
import time
from typing import Any, cast
import pytest
from requests.adapters import HTTPAdapter
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
def test_configure_retry(client: Client):
assert client.retri... | 3 | assert | numeric_literal | tests/test_http.py | test_configure_retry | 152 | null | |
matin/garth | from datetime import date
import pytest
from garth import HRVData
from garth.http import Client
@pytest.mark.vcr
def test_hrv_data_get(authed_client: Client):
hrv_data = HRVData.get("2023-07-20", client=authed_client)
assert hrv_data
assert hrv_data.user_profile_pk
assert hrv_data.hrv_summary.calenda... | None | assert | none_literal | tests/data/test_hrv_data.py | test_hrv_data_get | 16 | null | |
matin/garth | from datetime import date
import pytest
from garth import TrainingReadinessData
from garth.http import Client
@pytest.mark.vcr
def test_training_readiness_data_list(authed_client: Client):
days = 2
end = date(2025, 7, 7)
entries = TrainingReadinessData.list(
end, days, client=authed_client, max_w... | ( entries[i + 1].calendar_date, entries[i + 1].timestamp, ) | assert | collection | tests/data/test_training_readiness.py | test_training_readiness_data_list | 46 | null | |
matin/garth | from datetime import date
import pytest
from garth import MorningTrainingReadinessData
from garth.http import Client
@pytest.mark.vcr
def test_morning_training_readiness_data_get(authed_client: Client):
morning_training_readiness_data = MorningTrainingReadinessData.get(
"2025-07-07", client=authed_client... | None | assert | none_literal | tests/data/test_morning_training_readiness.py | test_morning_training_readiness_data_get | 23 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailyHRV
from garth.http import Client
@pytest.mark.vcr
def test_daily_hrv(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_hrv = DailyHRV.list(end, days, client=authed_client)
assert daily_hrv[-1].calendar_date == end
asse... | days | assert | variable | tests/stats/test_hrv.py | test_daily_hrv | 15 | null | |
matin/garth | from datetime import date
import pytest
from garth import FitnessActivity
from garth.http import Client
@pytest.mark.vcr
def test_fitness_activity_list(authed_client: Client):
activities = FitnessActivity.list(
date(2026, 1, 12), days=7, client=authed_client
)
assert len(activities) > | 0 | assert | numeric_literal | tests/data/test_fitness_stats.py | test_fitness_activity_list | 14 | null | |
matin/garth | from datetime import date, timedelta
import pytest
from garth import DailyStress, WeeklyStress
from garth.http import Client
@pytest.mark.vcr
def test_daily_stress(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_stress = DailyStress.list(end, days, client=authed_client)
assert daily_s... | days | assert | variable | tests/stats/test_stress.py | test_daily_stress | 15 | null | |
matin/garth | import tempfile
import time
from typing import Any, cast
import pytest
from requests.adapters import HTTPAdapter
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
def test_configure_backoff_factor(client: Client):
assert cli... | 0.5 | assert | numeric_literal | tests/test_http.py | test_configure_backoff_factor | 178 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailySummary
from garth.http import Client
@pytest.mark.vcr
def test_daily_summary_list(authed_client: Client):
days = 2
end = date(2025, 6, 14)
daily_summary = DailySummary.list(
end, days, client=authed_client, max_workers=1
)
a... | days | assert | variable | tests/data/test_daily_summary.py | test_daily_summary_list | 24 | null | |
matin/garth | import time
import pytest
from garth import sso
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
@pytest.mark.vcr
def test_login_return_on_mfa(client: Client):
result = sso.login(
"user@example.com",
"correct... | "needs_mfa" | assert | string_literal | tests/test_sso.py | test_login_return_on_mfa | 91 | null | |
matin/garth | import builtins
import getpass
import sys
import pytest
from garth.cli import main
def test_help_flag(monkeypatch, capsys):
# -h should print help and exit with code 0
monkeypatch.setattr(sys, "argv", ["garth", "-h"])
with pytest.raises(SystemExit) as excinfo:
main()
assert excinfo.value.code... | out.lower() | assert | func_call | tests/test_cli.py | test_help_flag | 17 | null | |
matin/garth | from datetime import date
import pytest
from garth import GarminScoresData
from garth.http import Client
@pytest.mark.vcr
def test_garmin_scores_data_get(authed_client: Client):
garmin_scores_data = GarminScoresData.get(
"2025-07-07", client=authed_client
)
assert garmin_scores_data
assert ga... | None | assert | none_literal | tests/data/test_garmin_scores.py | test_garmin_scores_data_get | 23 | null | |
matin/garth | import time
from garth.auth_tokens import OAuth1Token, OAuth2Token
def test_oauth1_repr_hides_secret(oauth1_token: OAuth1Token):
r = repr(oauth1_token)
assert "oauth_token_secret='***'" in | r | assert | variable | tests/test_auth_tokens.py | test_oauth1_repr_hides_secret | 22 | null | |
matin/garth | from datetime import date, timedelta
import pytest
from garth import DailySteps, WeeklySteps
from garth.http import Client
@pytest.mark.vcr
def test_daily_steps(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_steps = DailySteps.list(end, days, client=authed_client)
assert daily_steps... | end | assert | variable | tests/stats/test_steps.py | test_daily_steps | 14 | null | |
matin/garth | from datetime import date
import pytest
from garth import (
DailyTrainingStatus,
MonthlyTrainingStatus,
WeeklyTrainingStatus,
)
from garth.http import Client
@pytest.mark.vcr
def test_monthly_training_status_no_data(authed_client: Client):
end = date(2020, 1, 1) # Date far in the past with no data
... | [] | assert | collection | tests/stats/test_training_status.py | test_monthly_training_status_no_data | 72 | null | |
matin/garth | from datetime import date, timedelta
import pytest
from garth import DailySteps, WeeklySteps
from garth.http import Client
@pytest.mark.vcr
def test_daily_steps(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_steps = DailySteps.list(end, days, client=authed_client)
assert daily_steps[... | days | assert | variable | tests/stats/test_steps.py | test_daily_steps | 15 | null | |
matin/garth | import tempfile
import time
from typing import Any, cast
import pytest
from requests.adapters import HTTPAdapter
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
def test_configure_timeout(client: Client):
assert client.time... | 99 | assert | numeric_literal | tests/test_http.py | test_configure_timeout | 148 | null | |
matin/garth | from dataclasses import dataclass
from datetime import date, datetime
from garth.utils import (
asdict,
camel_to_snake,
camel_to_snake_dict,
format_end_date,
remove_dto_suffix,
remove_dto_suffix_from_dict,
)
def test_asdict():
# Test for dataclass instance
instance = AsDictTestClass("T... | now.isoformat() | assert | func_call | tests/test_utils.py | test_asdict | 62 | null | |
matin/garth | from dataclasses import dataclass
from datetime import date, datetime
from garth.utils import (
asdict,
camel_to_snake,
camel_to_snake_dict,
format_end_date,
remove_dto_suffix,
remove_dto_suffix_from_dict,
)
def test_asdict():
# Test for dataclass instance
instance = AsDictTestClass("T... | 123 | assert | numeric_literal | tests/test_utils.py | test_asdict | 66 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailySleep
from garth.http import Client
@pytest.mark.vcr
def test_daily_sleep(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_sleep = DailySleep.list(end, days, client=authed_client)
assert daily_sleep[-1].calendar_date == | end | assert | variable | tests/stats/test_sleep_stats.py | test_daily_sleep | 14 | null | |
matin/garth | import pytest
from garth import Activity
from garth.http import Client
@pytest.mark.vcr
def test_activity_list_pagination(authed_client: Client):
# Get first page
page1 = Activity.list(limit=2, start=0, client=authed_client)
# Get second page
page2 = Activity.list(limit=2, start=2, client=authed_clien... | 2 | assert | numeric_literal | tests/data/test_activity.py | test_activity_list_pagination | 43 | null | |
matin/garth | import time
from garth.auth_tokens import OAuth1Token, OAuth2Token
def test_is_expired(oauth2_token: OAuth2Token):
oauth2_token.expires_at = int(time.time() - 1)
assert oauth2_token.expired is | True | assert | bool_literal | tests/test_auth_tokens.py | test_is_expired | 8 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailySleepData
from garth.http import Client
@pytest.mark.vcr
def test_daily_sleep_data_get(authed_client: Client):
data = DailySleepData.get("2025-07-07", client=authed_client)
assert data is not None
assert data.daily_sleep_dto.calendar_date == ... | 0 | assert | numeric_literal | tests/data/test_daily_sleep_data.py | test_daily_sleep_data_get | 14 | null | |
matin/garth | from datetime import date
import pytest
from garth import TrainingReadinessData
from garth.http import Client
@pytest.mark.vcr
def test_training_readiness_data_get(authed_client: Client):
entries = TrainingReadinessData.get("2025-07-07", client=authed_client)
assert entries is not None
assert len(entrie... | 1 | assert | numeric_literal | tests/data/test_training_readiness.py | test_training_readiness_data_get | 13 | null | |
matin/garth | import pytest
from garth import DailyHeartRate
from garth.http import Client
@pytest.mark.vcr
def test_daily_heart_rate_list(authed_client: Client):
hr_list = DailyHeartRate.list(
end="2026-01-07", days=3, client=authed_client, max_workers=1
)
assert len(hr_list) > 0
# Should be sorted by date... | sorted(dates) | assert | func_call | tests/data/test_heart_rate.py | test_daily_heart_rate_list | 37 | null | |
matin/garth | from datetime import date, datetime, timedelta, timezone
import pytest
from garth.data import WeightData
from garth.http import Client
@pytest.mark.vcr
def test_weight_data_timestamps_preserved(authed_client: Client):
"""Test that raw timestamps are preserved and datetimes computed.
The API returns:
- t... | 1749996876000 | assert | numeric_literal | tests/data/test_weight_data.py | test_weight_data_timestamps_preserved | 29 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailySummary
from garth.http import Client
@pytest.mark.vcr
def test_daily_summary_list(authed_client: Client):
days = 2
end = date(2025, 6, 14)
daily_summary = DailySummary.list(
end, days, client=authed_client, max_workers=1
)
as... | end | assert | variable | tests/data/test_daily_summary.py | test_daily_summary_list | 25 | null | |
matin/garth | from datetime import date, timedelta
import pytest
from garth import DailyStress, WeeklyStress
from garth.http import Client
@pytest.mark.vcr
def test_weekly_stress(authed_client: Client):
end = date(2023, 7, 20)
weeks = 52
weekly_stress = WeeklyStress.list(end, weeks, client=authed_client)
assert le... | end - timedelta(days=6) | assert | func_call | tests/stats/test_stress.py | test_weekly_stress | 32 | null | |
matin/garth | import time
import pytest
from garth import sso
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
@pytest.mark.vcr
def test_exchange(authed_client: Client):
assert authed_client.oauth1_token and isinstance(
authed_cli... | "Bearer" | assert | string_literal | tests/test_sso.py | test_exchange | 128 | null | |
matin/garth | from datetime import date
import pytest
from garth import GarminScoresData
from garth.http import Client
@pytest.mark.vcr
def test_garmin_scores_data_list(authed_client: Client):
days = 2
end = date(2025, 7, 7)
garmin_scores = GarminScoresData.list(
end, days, client=authed_client, max_workers=1
... | end | assert | variable | tests/data/test_garmin_scores.py | test_garmin_scores_data_list | 34 | null | |
matin/garth | from dataclasses import dataclass
from datetime import date, datetime
from garth.utils import (
asdict,
camel_to_snake,
camel_to_snake_dict,
format_end_date,
remove_dto_suffix,
remove_dto_suffix_from_dict,
)
def test_remove_dto_suffix_from_dict():
# Simple dict with _dto keys
input_dic... | input_dict | assert | variable | tests/test_utils.py | test_remove_dto_suffix_from_dict | 132 | null | |
matin/garth | from datetime import date
import pytest
from garth import GarminScoresData
from garth.http import Client
@pytest.mark.vcr
def test_garmin_scores_data_list(authed_client: Client):
days = 2
end = date(2025, 7, 7)
garmin_scores = GarminScoresData.list(
end, days, client=authed_client, max_workers=1
... | days | assert | variable | tests/data/test_garmin_scores.py | test_garmin_scores_data_list | 33 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailySleepData
from garth.http import Client
@pytest.mark.vcr
def test_daily_sleep_data_list(authed_client: Client):
days = 2
end = date(2025, 7, 7)
data_list = DailySleepData.list(
end, days, client=authed_client, max_workers=1
)
... | data_list[i + 1].daily_sleep_dto.calendar_date | assert | complex_expr | tests/data/test_daily_sleep_data.py | test_daily_sleep_data_list | 49 | null | |
matin/garth | from dataclasses import dataclass
from datetime import date, datetime
from garth.utils import (
asdict,
camel_to_snake,
camel_to_snake_dict,
format_end_date,
remove_dto_suffix,
remove_dto_suffix_from_dict,
)
def test_remove_dto_suffix():
# Keys ending with _dto should have suffix removed
... | "" | assert | string_literal | tests/test_utils.py | test_remove_dto_suffix | 80 | null | |
matin/garth | import pytest
from garth import DailyHeartRate
from garth.http import Client
@pytest.mark.vcr
def test_daily_heart_rate_get(authed_client: Client):
hr = DailyHeartRate.get("2026-01-07", client=authed_client)
assert hr is not None
assert hr.resting_heart_rate > | 0 | assert | numeric_literal | tests/data/test_heart_rate.py | test_daily_heart_rate_get | 11 | null | |
matin/garth | import time
import pytest
from garth import sso
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
@pytest.mark.vcr
def test_login_return_on_mfa(client: Client):
result = sso.login(
"user@example.com",
"correct... | client_state | assert | variable | tests/test_sso.py | test_login_return_on_mfa | 92 | null | |
matin/garth | from datetime import date, datetime, timedelta, timezone
import pytest
from garth.data import WeightData
from garth.http import Client
@pytest.mark.vcr
def test_weight_data_list_empty(authed_client: Client):
end = date(2020, 1, 1)
days = 15
weight_data = WeightData.list(end, days, client=authed_client)
... | 0 | assert | numeric_literal | tests/data/test_weight_data.py | test_weight_data_list_empty | 105 | null | |
matin/garth | import builtins
import getpass
import sys
import pytest
from garth.cli import main
def test_help_flag(monkeypatch, capsys):
# -h should print help and exit with code 0
monkeypatch.setattr(sys, "argv", ["garth", "-h"])
with pytest.raises( | SystemExit) | pytest.raises | variable | tests/test_cli.py | test_help_flag | 13 | null | |
matin/garth | from datetime import date
import pytest
from garth import GarminScoresData
from garth.http import Client
@pytest.mark.vcr
def test_garmin_scores_data_get(authed_client: Client):
garmin_scores_data = GarminScoresData.get(
"2025-07-07", client=authed_client
)
assert garmin_scores_data
assert g... | date(2025, 7, 7) | assert | func_call | tests/data/test_garmin_scores.py | test_garmin_scores_data_get | 15 | null | |
matin/garth | from dataclasses import dataclass
from datetime import date, datetime
from garth.utils import (
asdict,
camel_to_snake,
camel_to_snake_dict,
format_end_date,
remove_dto_suffix,
remove_dto_suffix_from_dict,
)
def test_remove_dto_suffix_from_dict():
# Simple dict with _dto keys
input_dic... | expected | assert | variable | tests/test_utils.py | test_remove_dto_suffix_from_dict | 95 | null | |
matin/garth | from datetime import date
import pytest
from garth import DailyHRV
from garth.http import Client
@pytest.mark.vcr
def test_daily_hrv_no_results(authed_client: Client):
end = date(1990, 7, 20)
daily_hrv = DailyHRV.list(end, client=authed_client)
assert daily_hrv == | [] | assert | collection | tests/stats/test_hrv.py | test_daily_hrv_no_results | 31 | null | |
matin/garth | import builtins
import getpass
import sys
import pytest
from garth.cli import main
def test_help_flag(monkeypatch, capsys):
# -h should print help and exit with code 0
monkeypatch.setattr(sys, "argv", ["garth", "-h"])
with pytest.raises(SystemExit) as excinfo:
main()
assert excinfo.value.cod... | 0 | assert | numeric_literal | tests/test_cli.py | test_help_flag | 15 | null | |
matin/garth | from datetime import date
import pytest
from garth import (
DailyTrainingStatus,
MonthlyTrainingStatus,
WeeklyTrainingStatus,
)
from garth.http import Client
@pytest.mark.vcr
def test_daily_training_status(authed_client: Client):
end = date(2025, 6, 11)
daily_training_status = DailyTrainingStatus... | 1 | assert | numeric_literal | tests/stats/test_training_status.py | test_daily_training_status | 19 | null | |
matin/garth | from datetime import date, datetime
import pytest
from freezegun import freeze_time
from garth import DailyHydration
from garth.http import Client
from garth.stats.hydration import HydrationLogEntry
@pytest.mark.vcr
def test_daily_hydration_log(authed_client: Client):
timestamp = datetime(2026, 1, 9, 15, 30, 0)
... | timestamp | assert | variable | tests/stats/test_hydration.py | test_daily_hydration_log | 29 | null | |
matin/garth | from datetime import date
import pytest
from garth import MorningTrainingReadinessData
from garth.http import Client
@pytest.mark.vcr
def test_morning_training_readiness_data_list(authed_client: Client):
days = 2
end = date(2025, 7, 7)
morning_training_readiness = MorningTrainingReadinessData.list(
... | days | assert | variable | tests/data/test_morning_training_readiness.py | test_morning_training_readiness_data_list | 33 | null | |
matin/garth | from datetime import date, timedelta
import pytest
from garth import DailyStress, WeeklyStress
from garth.http import Client
@pytest.mark.vcr
def test_daily_stress(authed_client: Client):
end = date(2023, 7, 20)
days = 20
daily_stress = DailyStress.list(end, days, client=authed_client)
assert daily_... | end | assert | variable | tests/stats/test_stress.py | test_daily_stress | 14 | null | |
matin/garth | import time
import pytest
from garth import sso
from garth.auth_tokens import OAuth1Token, OAuth2Token
from garth.exc import GarthException, GarthHTTPError
from garth.http import Client
def test_set_expirations(oauth2_token_dict: dict):
token = sso.set_expirations(oauth2_token_dict)
assert ( | 1 | assert | numeric_literal | tests/test_sso.py | test_set_expirations | 108 | null | |
matin/garth | from datetime import date
import pytest
from garth import (
DailyTrainingStatus,
MonthlyTrainingStatus,
WeeklyTrainingStatus,
)
from garth.http import Client
@pytest.mark.vcr
def test_daily_training_status(authed_client: Client):
end = date(2025, 6, 11)
daily_training_status = DailyTrainingStatus... | end | assert | variable | tests/stats/test_training_status.py | test_daily_training_status | 20 | null | |
matin/garth | from datetime import date, datetime, timedelta, timezone
import pytest
from garth.data import WeightData
from garth.http import Client
@pytest.mark.vcr
def test_weight_data_timestamps_preserved(authed_client: Client):
"""Test that raw timestamps are preserved and datetimes computed.
The API returns:
- t... | None | assert | none_literal | tests/data/test_weight_data.py | test_weight_data_timestamps_preserved | 23 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.