From c32a66dd126b179c2762fc5377f0482a1edde071 Mon Sep 17 00:00:00 2001 From: Dennis Date: Sat, 17 Feb 2024 18:10:59 +0100 Subject: [PATCH] fix: black --- test/test_telegram.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test/test_telegram.py b/test/test_telegram.py index 10c4a593..9b703ab3 100644 --- a/test/test_telegram.py +++ b/test/test_telegram.py @@ -9,7 +9,7 @@ def test_load_sessions(mocker): - """ Test if the function returns a list of dictionaries """ + """Test if the function returns a list of dictionaries""" mock_file_content = sessions_txt mocker.patch("builtins.open", mock_open(read_data=mock_file_content)) result = TelegramReports.load_sessions("test_user") @@ -18,19 +18,19 @@ def test_load_sessions(mocker): def test_calculate_duration(): - """ Test if the function returns a number """ + """Test if the function returns a number""" result = TelegramReports._calculate_session_duration(sessions_json[0]) assert isinstance(result, int), "Expected an integer" def test_calculate_duration_not_finisched(): - """ Test if the function returns 0 if the session is not finished """ + """Test if the function returns 0 if the session is not finished""" result = TelegramReports._calculate_session_duration(sessions_json[1]) assert result == 0 def test_daily_summary(): - """ Test if the function returns a dictionary and the values are correct """ + """Test if the function returns a dictionary and the values are correct""" results = TelegramReports.daily_summary(sessions_json) assert isinstance(results, dict), "Expected a dictionary" assert results.get("2024-01-01", {}).get("total_likes") == 16, "Expected 16" @@ -43,15 +43,18 @@ def test_daily_summary(): def test_daily_summary_no_sessions(): - """ Test if the function returns an empty dictionary if no sessions are provided """ + """Test if the function returns an empty dictionary if no sessions are provided""" results = TelegramReports.daily_summary([]) assert results == {}, "Expected an empty dictionary" + def test_generate_report(): - """ Test if the function returns a string """ + """Test if the function returns a string""" daily_aggregated_data = TelegramReports.daily_summary(sessions_json) today_data = daily_aggregated_data.get("2024-01-02", {}) last_session = sessions_json[-1] last_session["duration"] = TelegramReports._calculate_session_duration(last_session) - results = TelegramReports.generate_report("test_user", last_session, today_data, 400, 400) - assert isinstance(results, str), "Expected a string" \ No newline at end of file + results = TelegramReports.generate_report( + "test_user", last_session, today_data, 400, 400 + ) + assert isinstance(results, str), "Expected a string"