Skip to content

Commit

Permalink
Shorten test names
Browse files Browse the repository at this point in the history
  • Loading branch information
parafoxia committed Sep 26, 2021
1 parent c83736e commit 27e7153
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 91 deletions.
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def client():
return client


def test_client_project_id_match(client):
def test_project_id_match(client):
with open("./secrets/secrets.json", mode="r", encoding="utf-8") as f:
project_id = json.load(f)["installed"]["project_id"]
assert client.project_id == project_id
6 changes: 3 additions & 3 deletions tests/test_dataframe_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def client():
sys.version_info >= (3, 10, 0),
reason="pandas does not support Python 3.10",
)
def test_dataframe_day_is_datetime(client):
def test_day_is_datetime(client):
import pandas as pd

report = client.retrieve(dt.date(2021, 1, 1), dimensions=("day",))
Expand All @@ -57,7 +57,7 @@ def test_dataframe_day_is_datetime(client):
sys.version_info >= (3, 10, 0),
reason="pandas does not support Python 3.10",
)
def test_dataframe_month_is_datetime(client):
def test_month_is_datetime(client):
import pandas as pd

report = client.retrieve(
Expand All @@ -71,7 +71,7 @@ def test_dataframe_month_is_datetime(client):
sys.version_info >= (3, 10, 0),
reason="pandas does not support Python 3.10",
)
def test_dataframe_metrics_are_numeric(client):
def test_metrics_are_numeric(client):
import pandas as pd

report = client.retrieve(dt.date(2021, 1, 1), dimensions=("day",))
Expand Down
22 changes: 11 additions & 11 deletions tests/test_factory_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def client():
return client


def test_factory_report_daily_analytics_rows_correct(client):
def test_daily_analytics_rows_correct(client):
report = client.daily_analytics()
assert report.type == "Time-based activity"
assert report.shape[0] == 28 or report.shape[0] == 29
Expand All @@ -49,19 +49,19 @@ def test_factory_report_daily_analytics_rows_correct(client):
assert report.shape[0] == 10 or report.shape[0] == 11


def test_factory_report_daily_analytics_start_date(client):
def test_daily_analytics_start_date(client):
report = client.daily_analytics(since=dt.date(2021, 1, 1))
assert report.type == "Time-based activity"
assert report.data["rows"][0][0] == "2021-01-01"


def test_factory_report_daily_analytics_metrics(client):
def test_daily_analytics_metrics(client):
report = client.daily_analytics(metrics=("views", "likes", "comments"))
assert report.type == "Time-based activity"
assert report.shape[1] == 4


def test_factory_report_monthly_analytics_rows_correct(client):
def test_monthly_analytics_rows_correct(client):
report = client.monthly_analytics()
assert report.type == "Time-based activity"
assert report.shape[0] == 3
Expand All @@ -70,7 +70,7 @@ def test_factory_report_monthly_analytics_rows_correct(client):
assert report.shape[0] == 10


def test_factory_report_monthly_analytics_start_date(client):
def test_monthly_analytics_start_date(client):
report = client.monthly_analytics(since=dt.date(2021, 1, 1))
assert report.type == "Time-based activity"
assert report.data["rows"][0][0] == "2021-01"
Expand All @@ -79,7 +79,7 @@ def test_factory_report_monthly_analytics_start_date(client):
assert report.data["rows"][0][0] == "2020-06"


def test_factory_report_monthly_analytics_end_date(client):
def test_monthly_analytics_end_date(client):
report = client.monthly_analytics(since=dt.date(2021, 1, 1))
assert report.type == "Time-based activity"
last_month = dt.date.today() - dt.timedelta(days=30)
Expand All @@ -88,33 +88,33 @@ def test_factory_report_monthly_analytics_end_date(client):
).strftime("%Y-%m")


def test_factory_report_monthly_analytics_metrics(client):
def test_monthly_analytics_metrics(client):
report = client.monthly_analytics(metrics=("views", "likes", "comments"))
assert report.type == "Time-based activity"
assert report.shape[1] == 4


def test_factory_report_regional_analytics_metrics_sorted(client):
def test_regional_analytics_metrics_sorted(client):
report = client.regional_analytics()
assert report.type == "Geography-based activity"
arr = [r[1] for r in report.data["rows"]]
assert arr == sorted(arr, reverse=True)


def test_factory_report_regional_analytics_metrics(client):
def test_regional_analytics_metrics(client):
report = client.regional_analytics(metrics=("views", "likes", "comments"))
assert report.type == "Geography-based activity"
assert report.shape[1] == 4


def test_factory_report_top_videos_metrics_sorted(client):
def test_top_videos_metrics_sorted(client):
report = client.top_videos()
assert report.type == "Top videos by region"
arr = [r[1] for r in report.data["rows"]]
assert arr == sorted(arr, reverse=True)


def test_factory_report_top_videos_metrics(client):
def test_top_videos_metrics(client):
report = client.top_videos(metrics=("views", "likes", "comments"))
assert report.type == "Top videos by region"
assert report.shape[1] == 4
4 changes: 2 additions & 2 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def client():
return client


def test_files_json(client):
def test_save_as_json(client):
report = client.retrieve(
dt.date(2021, 1, 1), dt.date(2021, 2, 28), dimensions=("day",)
)
Expand All @@ -55,7 +55,7 @@ def test_files_json(client):
os.remove("./test.json")


def test_files_csv(client):
def test_save_as_csv(client):
report = client.retrieve(
dt.date(2021, 1, 1), dt.date(2021, 2, 28), dimensions=("day",)
)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_report_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def client():
return client


def test_reports_shape(client):
def test_shape(client):
report = client.retrieve(
dt.date(2021, 1, 1), dt.date(2021, 2, 28), dimensions=("day",)
)
assert report.shape == (59, 36)


def test_reports_max_results(client):
def test_max_results(client):
report = client.retrieve(
dt.date(2021, 1, 1),
dt.date(2021, 2, 28),
Expand All @@ -57,7 +57,7 @@ def test_reports_max_results(client):
assert report.shape == (20, 36)


def test_reports_sort_ascending(client):
def test_sort_ascending(client):
report = client.retrieve(
dt.date(2021, 1, 1),
dt.date(2021, 2, 28),
Expand All @@ -68,7 +68,7 @@ def test_reports_sort_ascending(client):
assert arr == sorted(arr)


def test_reports_sort_descending(client):
def test_sort_descending(client):
report = client.retrieve(
dt.date(2021, 1, 1),
dt.date(2021, 2, 28),
Expand Down
Loading

0 comments on commit 27e7153

Please sign in to comment.