File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 10
10
11
11
# Open classifier in global scope
12
12
# with open("models/wine.pkl", "rb") as file:
13
- with open ("models/wine-95.pkl" , "rb" ) as file :
13
+ with open ("models/wine-95-fixed .pkl" , "rb" ) as file :
14
14
clf = pickle .load (file )
15
15
16
16
Original file line number Diff line number Diff line change 1
1
import pickle
2
2
from main import clf
3
+ from sklearn .pipeline import Pipeline
4
+ from sklearn .preprocessing import StandardScaler
3
5
4
6
5
7
def test_accuracy ():
@@ -16,3 +18,15 @@ def test_accuracy():
16
18
17
19
# Accuracy should be over 90%
18
20
assert acc > 0.9
21
+
22
+ def test_pipeline_and_scaler ():
23
+
24
+ # Check if clf is an instance of sklearn.pipeline.Pipeline
25
+ isPipeline = isinstance (clf , Pipeline )
26
+ assert isPipeline
27
+
28
+ if isPipeline :
29
+ # Check if first step of pipeline is an instance of
30
+ # sklearn.preprocessing.StandardScaler
31
+ firstStep = [v for v in clf .named_steps .values ()][0 ]
32
+ assert isinstance (firstStep , StandardScaler )
You can’t perform that action at this time.
0 commit comments