Skip to content

Commit aa1724d

Browse files
committed
fix: ruff errors in tests
optimize imports remove unused vars add missing parameters
1 parent fbfdfd3 commit aa1724d

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

tests/test_reporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import json
22
import time
3-
from unittest.mock import mock_open, patch, MagicMock
3+
from unittest.mock import MagicMock, mock_open, patch
44

55
from cat_ai import analyse_sample_from_test
6-
from src.cat_ai.reporter import Reporter
76
from src.cat_ai.helpers.helpers import root_dir
7+
from src.cat_ai.reporter import Reporter
88

99

1010
def test_reporter_creates_a_unique_folder_path() -> None:

tests/test_statistical_analysis.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import csv
22
import io
3+
import math
34
import os
4-
5-
import pytest
65
from statistics import NormalDist
7-
import math
6+
87
import matplotlib.pyplot as plt
98
import numpy as np
9+
import pytest
1010

11-
from cat_ai.statistical_analysis import analyse_sample_from_test, StatisticalAnalysis
11+
from cat_ai.statistical_analysis import StatisticalAnalysis, analyse_sample_from_test
1212

1313

1414
@pytest.mark.parametrize(
@@ -113,9 +113,7 @@ def test_failure_rate_bar_graph(snapshot):
113113
fig, ax = plt.subplots(figsize=(10, 6))
114114

115115
# Plot bars with error bars
116-
bars = ax.bar(
117-
failure_counts, rates, yerr=errors, capsize=5, color="steelblue", alpha=0.7, width=8
118-
)
116+
ax.bar(failure_counts, rates, yerr=errors, capsize=5, color="steelblue", alpha=0.7, width=8)
119117

120118
# # Add annotations on top of each bar
121119
# for bar, rate, error in zip(bars, rates, errors):
@@ -157,7 +155,7 @@ def test_failure_rate_graph(snapshot):
157155
failures = np.arange(0, 100)
158156

159157
# Calculate results for each rate
160-
results = [analyse_sample_from_test(f, t) for f, t in zip(failures, totals)]
158+
results = [analyse_sample_from_test(f, t) for f, t in zip(failures, totals, strict=True)]
161159

162160
# Extract data for plotting
163161
rates = [r.proportion for r in results]

0 commit comments

Comments
 (0)