Skip to content

Commit 9c2bd1e

Browse files
committed
black reformatting
1 parent 2bd7d80 commit 9c2bd1e

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/sasctl/pzmm/write_score_code.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def score(var1, var2, var3, var4):
250250
input_var_list,
251251
missing_values=missing_values,
252252
dtype_list=input_dtypes_list,
253-
preprocess_function=preprocess_function
253+
preprocess_function=preprocess_function,
254254
)
255255
self._predictions_to_metrics(
256256
score_metrics,
@@ -267,7 +267,7 @@ def score(var1, var2, var3, var4):
267267
missing_values=missing_values,
268268
statsmodels_model="statsmodels_model" in kwargs,
269269
tf_model="tf_keras_model" in kwargs or "tf_core_model" in kwargs,
270-
preprocess_function=preprocess_function
270+
preprocess_function=preprocess_function,
271271
)
272272
# Include check for numpy values and a conversion operation as needed
273273
self.score_code += (
@@ -2263,7 +2263,9 @@ def _viya35_score_code_import(
22632263
mr.update_model(model)
22642264
return mas_code, cas_code
22652265

2266-
def _add_preprocess_code(self, preprocess_function: Callable[[DataFrame], DataFrame]):
2266+
def _add_preprocess_code(
2267+
self, preprocess_function: Callable[[DataFrame], DataFrame]
2268+
):
22672269
"""
22682270
Places the given preprocess function, which must both take a DataFrame as an argument
22692271
and return a DataFrame, into the score code. If the preprocess function does not

tests/unit/test_write_score_code.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def test_impute_missing_values():
188188
assert "'b': 'test'" in sc.score_code
189189
assert "'c': 1" in sc.score_code or "'c': np.int64(1)" in sc.score_code
190190

191+
191192
def test_preprocess_function():
192193
"""
193194
Test Cases:
@@ -199,20 +200,24 @@ def test_preprocess_function():
199200
)
200201
sc = ScoreCode()
201202
sc.score_code = " "
203+
202204
def preprocess_function_one(data: pd.DataFrame):
203205
print("preprocessing happens here")
204206
return data
207+
205208
sc._add_preprocess_code(preprocess_function_one)
206209
assert "preprocessing happens here" in sc.score_code
207210
assert "preprocess_function_one" in sc.score_code
208211

209212
sc = ScoreCode()
210213
sc.score_code = " "
214+
211215
def preprocess_function_two(data: pd.DataFrame):
212216
print("preprocessing happens here?")
217+
213218
with pytest.raises(ValueError):
214219
sc._add_preprocess_code(preprocess_function_two)
215-
220+
216221

217222
def test_predict_method():
218223
"""

0 commit comments

Comments
 (0)