Skip to content

Commit

Permalink
Format files
Browse files Browse the repository at this point in the history
  • Loading branch information
VirajP1002 committed Jul 31, 2024
1 parent eb7fef9 commit e65f920
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 27 deletions.
4 changes: 3 additions & 1 deletion scripts/visualise_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,7 @@ def get_data_frame_session_pdf(results):
dataframe = get_data_frame(get_results(folders, number_of_days))
plot_performance_data(dataframe, number_of_days)

pdf_session_dataframe = get_data_frame_session_pdf(get_results(folders, number_of_days))
pdf_session_dataframe = get_data_frame_session_pdf(
get_results(folders, number_of_days)
)
plot_additional_metrics(pdf_session_dataframe, number_of_days)
56 changes: 30 additions & 26 deletions tests/test_visualise_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
from pandas.testing import assert_frame_equal

from scripts.get_summary import get_results
from scripts.visualise_results import GraphGenerationFailed, get_data_frame, plot_data, get_data_frame_session_pdf, \
plot_performance_data, plot_additional_metrics
from scripts.visualise_results import (
GraphGenerationFailed,
get_data_frame,
get_data_frame_session_pdf,
plot_additional_metrics,
plot_performance_data,
)

expected_data_frame = DataFrame.from_dict(
{"DATE": ["2024-02-07"], "50th": [58], "90th": [96], "95th": [173], "99th": [301]}
Expand Down Expand Up @@ -36,16 +41,16 @@
@pytest.mark.parametrize(
"results_file_fixture, data_frame_method, expected_result",
(
("get_results_single_file", get_data_frame, expected_data_frame),
(
"get_results_single_file_with_pdf_endpoint",
get_data_frame_session_pdf,
expected_data_frame_session_pdf,
),
("get_results_single_file", get_data_frame, expected_data_frame),
(
"get_results_single_file_with_pdf_endpoint",
get_data_frame_session_pdf,
expected_data_frame_session_pdf,
),
),
)
def test_get_data_frame_single_file(
results_file_fixture, data_frame_method, expected_result, request
results_file_fixture, data_frame_method, expected_result, request
):
dataframe = data_frame_method(request.getfixturevalue(results_file_fixture))
assert_frame_equal(dataframe, expected_result)
Expand All @@ -54,22 +59,22 @@ def test_get_data_frame_single_file(
@pytest.mark.parametrize(
"folders, data_frame_method, expected_result",
(
(
[
"./tests/mock_stats/2024-02-07T03:09:41",
"./tests/mock_stats/2024-02-06T03:09:41",
],
get_data_frame,
expected_data_frame_multiple_files,
),
(
[
"./tests/mock_stats/2024-07-25T03:09:41",
"./tests/mock_stats/2024-07-29T03:09:41",
],
get_data_frame_session_pdf,
expected_data_frame_multiple_files_session_pdf,
),
(
[
"./tests/mock_stats/2024-02-07T03:09:41",
"./tests/mock_stats/2024-02-06T03:09:41",
],
get_data_frame,
expected_data_frame_multiple_files,
),
(
[
"./tests/mock_stats/2024-07-25T03:09:41",
"./tests/mock_stats/2024-07-29T03:09:41",
],
get_data_frame_session_pdf,
expected_data_frame_multiple_files_session_pdf,
),
),
)
def test_get_data_frame_multiple_files(folders, data_frame_method, expected_result):
Expand Down Expand Up @@ -118,4 +123,3 @@ def test_plot_additional_metrics_failed():
dataframe = DataFrame.from_dict({})
with pytest.raises(GraphGenerationFailed):
plot_additional_metrics(dataframe, 1)

0 comments on commit e65f920

Please sign in to comment.