Skip to content

Commit 7b1e5c1

Browse files
authored
infra: black format unit tests (#2305)
1 parent aad9f6d commit 7b1e5c1

22 files changed

+39
-39
lines changed

tests/unit/sagemaker/model/test_framework_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, sagemaker_session, **kwargs):
5656
ROLE,
5757
ENTRY_POINT,
5858
sagemaker_session=sagemaker_session,
59-
**kwargs
59+
**kwargs,
6060
)
6161

6262
def create_predictor(self, endpoint_name):
@@ -71,7 +71,7 @@ def __init__(self, sagemaker_session, entry_point, **kwargs):
7171
ROLE,
7272
entry_point=entry_point,
7373
sagemaker_session=sagemaker_session,
74-
**kwargs
74+
**kwargs,
7575
)
7676

7777
def create_predictor(self, endpoint_name):

tests/unit/sagemaker/tensorflow/test_estimator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def _build_tf(
159159
py_version=None,
160160
instance_type=None,
161161
base_job_name=None,
162-
**kwargs
162+
**kwargs,
163163
):
164164
return TensorFlow(
165165
entry_point=SCRIPT_PATH,
@@ -170,7 +170,7 @@ def _build_tf(
170170
instance_count=INSTANCE_COUNT,
171171
instance_type=instance_type if instance_type else INSTANCE_TYPE,
172172
base_job_name=base_job_name,
173-
**kwargs
173+
**kwargs,
174174
)
175175

176176

tests/unit/sagemaker/tensorflow/test_estimator_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _build_tf(sagemaker_session, **kwargs):
3535
role="dummy-role",
3636
instance_count=1,
3737
instance_type="ml.c4.xlarge",
38-
**kwargs
38+
**kwargs,
3939
)
4040

4141

tests/unit/test_amazon_estimator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_init_enable_network_isolation(sagemaker_session):
8686
num_components=55,
8787
sagemaker_session=sagemaker_session,
8888
enable_network_isolation=True,
89-
**COMMON_ARGS
89+
**COMMON_ARGS,
9090
)
9191
assert pca.num_components == 55
9292
assert pca.enable_network_isolation() is True
@@ -99,7 +99,7 @@ def test_init_all_pca_hyperparameters(sagemaker_session):
9999
subtract_mean=True,
100100
extra_components=33,
101101
sagemaker_session=sagemaker_session,
102-
**COMMON_ARGS
102+
**COMMON_ARGS,
103103
)
104104
assert pca.num_components == 55
105105
assert pca.algorithm_mode == "randomized"
@@ -112,7 +112,7 @@ def test_init_estimator_args(sagemaker_session):
112112
max_run=1234,
113113
sagemaker_session=sagemaker_session,
114114
data_location="s3://some-bucket/some-key/",
115-
**COMMON_ARGS
115+
**COMMON_ARGS,
116116
)
117117
assert pca.instance_type == COMMON_ARGS["instance_type"]
118118
assert pca.instance_count == COMMON_ARGS["instance_count"]
@@ -133,7 +133,7 @@ def test_data_location_does_not_call_default_bucket(sagemaker_session):
133133
num_components=2,
134134
sagemaker_session=sagemaker_session,
135135
data_location=data_location,
136-
**COMMON_ARGS
136+
**COMMON_ARGS,
137137
)
138138
assert pca.data_location == data_location
139139
assert not sagemaker_session.default_bucket.called
@@ -205,7 +205,7 @@ def test_fit_ndarray(time, sagemaker_session):
205205
num_components=55,
206206
sagemaker_session=sagemaker_session,
207207
data_location="s3://{}/key-prefix/".format(BUCKET_NAME),
208-
**kwargs
208+
**kwargs,
209209
)
210210
train = [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 8.0], [44.0, 55.0, 66.0]]
211211
labels = [99, 85, 87, 2]
@@ -233,7 +233,7 @@ def test_fit_pass_experiment_config(sagemaker_session):
233233
num_components=55,
234234
sagemaker_session=sagemaker_session,
235235
data_location="s3://{}/key-prefix/".format(BUCKET_NAME),
236-
**kwargs
236+
**kwargs,
237237
)
238238
train = [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 8.0], [44.0, 55.0, 66.0]]
239239
labels = [99, 85, 87, 2]

tests/unit/test_chainer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def _chainer_estimator(
8888
num_processes=None,
8989
process_slots_per_host=None,
9090
additional_mpi_options=None,
91-
**kwargs
91+
**kwargs,
9292
):
9393
return Chainer(
9494
entry_point=SCRIPT_PATH,
@@ -103,7 +103,7 @@ def _chainer_estimator(
103103
num_processes=num_processes,
104104
process_slots_per_host=process_slots_per_host,
105105
additional_mpi_options=additional_mpi_options,
106-
**kwargs
106+
**kwargs,
107107
)
108108

109109

tests/unit/test_estimator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def create_model(
140140
vpc_config_override=vpc_utils.VPC_CONFIG_DEFAULT,
141141
enable_network_isolation=None,
142142
model_dir=None,
143-
**kwargs
143+
**kwargs,
144144
):
145145
if enable_network_isolation is None:
146146
enable_network_isolation = self.enable_network_isolation()
@@ -151,7 +151,7 @@ def create_model(
151151
entry_point=entry_point,
152152
enable_network_isolation=enable_network_isolation,
153153
role=role,
154-
**kwargs
154+
**kwargs,
155155
)
156156

157157
@classmethod
@@ -171,7 +171,7 @@ def __init__(self, sagemaker_session, entry_point=None, role=ROLE, **kwargs):
171171
role,
172172
entry_point or ENTRY_POINT,
173173
sagemaker_session=sagemaker_session,
174-
**kwargs
174+
**kwargs,
175175
)
176176

177177
def create_predictor(self, endpoint_name):

tests/unit/test_fm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_all_hyperparameters(sagemaker_session):
115115
factors_init_scale=1.101,
116116
factors_init_sigma=1.202,
117117
factors_init_value=1.303,
118-
**ALL_REQ_ARGS
118+
**ALL_REQ_ARGS,
119119
)
120120
assert fm.hyperparameters() == dict(
121121
num_factors=str(ALL_REQ_ARGS["num_factors"]),

tests/unit/test_image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,10 +751,10 @@ def test_ecr_login_needed(check_output):
751751
token_response = "AWS:%s" % token
752752
b64_token = base64.b64encode(token_response.encode("utf-8"))
753753
response = {
754-
u"authorizationData": [
754+
"authorizationData": [
755755
{
756-
u"authorizationToken": b64_token,
757-
u"proxyEndpoint": u"https://520713654638.dkr.ecr.us-east-1.amazonaws.com",
756+
"authorizationToken": b64_token,
757+
"proxyEndpoint": "https://520713654638.dkr.ecr.us-east-1.amazonaws.com",
758758
}
759759
],
760760
"ResponseMetadata": {

tests/unit/test_ipinsights.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def test_all_hyperparameters(sagemaker_session):
103103
random_negative_sampling_rate=5,
104104
shuffled_negative_sampling_rate=5,
105105
weight_decay=5.0,
106-
**ALL_REQ_ARGS
106+
**ALL_REQ_ARGS,
107107
)
108108
assert ipinsights.hyperparameters() == dict(
109109
num_entity_vectors=str(ALL_REQ_ARGS["num_entity_vectors"]),

tests/unit/test_job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __init__(self, sagemaker_session, **kwargs):
107107
ROLE,
108108
SCRIPT_NAME,
109109
sagemaker_session=sagemaker_session,
110-
**kwargs
110+
**kwargs,
111111
)
112112

113113
def prepare_container_def(self, instance_type, accelerator_type=None):

tests/unit/test_kmeans.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_all_hyperparameters(sagemaker_session):
9393
epochs=10,
9494
center_factor=2,
9595
eval_metrics=["msd", "ssd"],
96-
**ALL_REQ_ARGS
96+
**ALL_REQ_ARGS,
9797
)
9898
assert kmeans.hyperparameters() == dict(
9999
k=str(ALL_REQ_ARGS["k"]),

tests/unit/test_knn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
}
3535
ALL_REQ_ARGS = dict(
3636
{"k": K, "sample_size": SAMPLE_SIZE, "predictor_type": PREDICTOR_TYPE_REGRESSOR},
37-
**COMMON_TRAIN_ARGS
37+
**COMMON_TRAIN_ARGS,
3838
)
3939

4040
REGION = "us-west-2"
@@ -104,7 +104,7 @@ def test_all_hyperparameters_regressor(sagemaker_session):
104104
index_metric="COSINE",
105105
faiss_index_ivf_nlists="auto",
106106
faiss_index_pq_m=1,
107-
**ALL_REQ_ARGS
107+
**ALL_REQ_ARGS,
108108
)
109109
assert knn.hyperparameters() == dict(
110110
k=str(ALL_REQ_ARGS["k"]),
@@ -130,7 +130,7 @@ def test_all_hyperparameters_classifier(sagemaker_session):
130130
index_type="faiss.IVFFlat",
131131
index_metric="L2",
132132
faiss_index_ivf_nlists="20",
133-
**test_params
133+
**test_params,
134134
)
135135
assert knn.hyperparameters() == dict(
136136
k=str(ALL_REQ_ARGS["k"]),

tests/unit/test_lda.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_all_hyperparameters(sagemaker_session):
8383
max_restarts=3,
8484
max_iterations=10,
8585
tol=3.3,
86-
**ALL_REQ_ARGS
86+
**ALL_REQ_ARGS,
8787
)
8888
assert lda.hyperparameters() == dict(
8989
num_topics=str(ALL_REQ_ARGS["num_topics"]),

tests/unit/test_linear_learner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_all_hyperparameters(sagemaker_session):
132132
accuracy_top_k=3,
133133
f_beta=1.0,
134134
balance_multiclass_weights=False,
135-
**ALL_REQ_ARGS
135+
**ALL_REQ_ARGS,
136136
)
137137

138138
assert lr.hyperparameters() == dict(

tests/unit/test_ntm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_all_hyperparameters(sagemaker_session):
101101
clip_gradient=0.5,
102102
weight_decay=0.5,
103103
learning_rate=0.5,
104-
**ALL_REQ_ARGS
104+
**ALL_REQ_ARGS,
105105
)
106106
assert ntm.hyperparameters() == dict(
107107
num_topics=str(ALL_REQ_ARGS["num_topics"]),

tests/unit/test_object2vec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
}
3737
ALL_REQ_ARGS = dict(
3838
{"epochs": EPOCHS, "enc0_max_seq_len": ENC0_MAX_SEQ_LEN, "enc0_vocab_size": ENC0_VOCAB_SIZE},
39-
**COMMON_TRAIN_ARGS
39+
**COMMON_TRAIN_ARGS,
4040
)
4141

4242
REGION = "us-west-2"
@@ -134,7 +134,7 @@ def test_all_hyperparameters(sagemaker_session):
134134
enc1_layers=3,
135135
enc0_freeze_pretrained_embedding=True,
136136
enc1_freeze_pretrained_embedding=False,
137-
**ALL_REQ_ARGS
137+
**ALL_REQ_ARGS,
138138
)
139139

140140
hp = object2vec.hyperparameters()

tests/unit/test_pca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_all_hyperparameters(sagemaker_session):
9393
algorithm_mode="regular",
9494
subtract_mean="True",
9595
extra_components=1,
96-
**ALL_REQ_ARGS
96+
**ALL_REQ_ARGS,
9797
)
9898
assert pca.hyperparameters() == dict(
9999
num_components=str(ALL_REQ_ARGS["num_components"]),

tests/unit/test_pipeline_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, sagemaker_session, **kwargs):
4747
ROLE,
4848
ENTRY_POINT,
4949
sagemaker_session=sagemaker_session,
50-
**kwargs
50+
**kwargs,
5151
)
5252

5353
def create_predictor(self, endpoint_name):

tests/unit/test_randomcutforest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_all_hyperparameters(sagemaker_session):
9696
num_trees=NUM_TREES,
9797
num_samples_per_tree=NUM_SAMPLES_PER_TREE,
9898
eval_metrics=EVAL_METRICS,
99-
**ALL_REQ_ARGS
99+
**ALL_REQ_ARGS,
100100
)
101101
assert randomcutforest.hyperparameters() == dict(
102102
num_samples_per_tree=str(NUM_SAMPLES_PER_TREE),

tests/unit/test_sklearn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _sklearn_estimator(
9292
instance_type=instance_type if instance_type else INSTANCE_TYPE,
9393
base_job_name=base_job_name,
9494
py_version=PYTHON_VERSION,
95-
**kwargs
95+
**kwargs,
9696
)
9797

9898

tests/unit/test_tuner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ def test_deploy_optional_params(_get_best_training_job, best_estimator, tuner):
889889
wait=False,
890890
model_name=model_name,
891891
kms_key=kms_key,
892-
**kwargs
892+
**kwargs,
893893
)
894894

895895
best_estimator.assert_called_with(training_job)
@@ -905,7 +905,7 @@ def test_deploy_optional_params(_get_best_training_job, best_estimator, tuner):
905905
model_name=model_name,
906906
kms_key=kms_key,
907907
data_capture_config=None,
908-
**kwargs
908+
**kwargs,
909909
)
910910

911911

tests/unit/test_xgboost.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _xgboost_estimator(
9393
instance_type=None,
9494
instance_count=1,
9595
base_job_name=None,
96-
**kwargs
96+
**kwargs,
9797
):
9898

9999
return XGBoost(
@@ -105,7 +105,7 @@ def _xgboost_estimator(
105105
instance_count=instance_count,
106106
base_job_name=base_job_name,
107107
py_version=PYTHON_VERSION,
108-
**kwargs
108+
**kwargs,
109109
)
110110

111111

0 commit comments

Comments
 (0)