Skip to content

Commit 474ffcb

Browse files
Remove if __name__ == "__main__" from test files because it is unused with pytest
1 parent e282cc3 commit 474ffcb

File tree

90 files changed

+0
-196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+0
-196
lines changed

tensorflow_model_analysis/api/dataframe_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -516,5 +516,3 @@ def testAutoPivot_PlotsDataFrameCollapseColumnNames(self):
516516
)
517517
pd.testing.assert_frame_equal(expected, df, check_column_type=False)
518518

519-
if __name__ == '__main__':
520-
tf.test.main()

tensorflow_model_analysis/api/model_eval_lib_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,3 @@ def testBytesProcessedCountForRecordBatches(self):
15831583
self.assertEqual(actual_counter[0].committed, expected_num_bytes)
15841584

15851585

1586-
if __name__ == '__main__':
1587-
tf.compat.v1.enable_v2_behavior()
1588-
tf.test.main()

tensorflow_model_analysis/api/types_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,3 @@ def testVarLenTensorValueEmpty(self):
9191
)
9292

9393

94-
if __name__ == '__main__':
95-
absltest.main()

tensorflow_model_analysis/contrib/aggregates/binary_confusion_matrices_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -300,5 +300,3 @@ def testBinaryConfusionMatricesInProcess(
300300
self.assertDictEqual(actual, expected_result)
301301

302302

303-
if __name__ == '__main__':
304-
tf.test.main()

tensorflow_model_analysis/evaluators/analysis_table_evaluator_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,3 @@ def check_result(got):
9797
util.assert_that(got[constants.ANALYSIS_KEY], check_result)
9898

9999

100-
if __name__ == '__main__':
101-
tf.test.main()

tensorflow_model_analysis/evaluators/confidence_intervals_util_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -329,5 +329,3 @@ def check_result(got_pcoll):
329329
util.assert_that(result, check_result)
330330

331331

332-
if __name__ == '__main__':
333-
absltest.main()

tensorflow_model_analysis/evaluators/counter_util_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,3 @@ def testMetricsSpecBeamCounter(self):
6969
self.assertEqual(actual_metrics_count, 1)
7070

7171

72-
if __name__ == '__main__':
73-
tf.test.main()

tensorflow_model_analysis/evaluators/evaluator_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,3 @@ def testVerifyEvaluatorRaisesValueError(self):
4545
)
4646

4747

48-
if __name__ == '__main__':
49-
tf.test.main()

tensorflow_model_analysis/evaluators/jackknife_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -276,5 +276,3 @@ def check_result(got_pcoll):
276276
util.assert_that(result, check_result)
277277

278278

279-
if __name__ == '__main__':
280-
absltest.main()

tensorflow_model_analysis/evaluators/legacy_poisson_bootstrap_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,3 @@ def testCalculateConfidenceInterval(self):
9090
)
9191

9292

93-
if __name__ == '__main__':
94-
tf.test.main()

tensorflow_model_analysis/evaluators/metrics_plots_and_validations_evaluator_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,3 @@ def testMetricsSpecsCountersInModelAgnosticMode(self):
930930
self.assertEqual(actual_metrics_count, 1)
931931

932932

933-
if __name__ == '__main__':
934-
tf.compat.v1.enable_v2_behavior()
935-
tf.test.main()

tensorflow_model_analysis/evaluators/metrics_validator_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,3 @@ def testValidateMetricsDivByZero(self):
15441544
self.assertFalse(result.validation_ok)
15451545

15461546

1547-
if __name__ == '__main__':
1548-
tf.compat.v1.enable_v2_behavior()
1549-
tf.test.main()

tensorflow_model_analysis/evaluators/poisson_bootstrap_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -349,5 +349,3 @@ def check_result(got_pcoll):
349349
util.assert_that(result, check_result)
350350

351351

352-
if __name__ == '__main__':
353-
absltest.main()

tensorflow_model_analysis/experimental/preprocessing_functions/text_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,3 @@ def testWhitespaceTokenization(self, input_text, expected_output):
3838
self.assertAllEqual(actual, expected)
3939

4040

41-
if __name__ == '__main__':
42-
tf.test.main()

tensorflow_model_analysis/extractors/counterfactual_predictions_extractor_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,3 @@ def check_result(got):
277277
util.assert_that(result, check_result, label='result')
278278

279279

280-
if __name__ == '__main__':
281-
tf.compat.v1.enable_v2_behavior()
282-
tf.test.main()

tensorflow_model_analysis/extractors/example_weights_extractor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -311,5 +311,3 @@ def check_result(got):
311311
util.assert_that(result, check_result, label='result')
312312

313313

314-
if __name__ == '__main__':
315-
tf.test.main()

tensorflow_model_analysis/extractors/extractor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,3 @@ def check_result(got):
116116
util.assert_that(got, check_result)
117117

118118

119-
if __name__ == '__main__':
120-
tf.test.main()

tensorflow_model_analysis/extractors/features_extractor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,3 @@ def check_result(got):
159159
util.assert_that(result, check_result, label='result')
160160

161161

162-
if __name__ == '__main__':
163-
tf.test.main()

tensorflow_model_analysis/extractors/inference_base_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -407,5 +407,3 @@ def testInsertPredictionLogsWithCustomPathIntoExtracts(self):
407407
self.assertEqual(extracts['foo']['bar'], ref_extracts['foo']['bar'])
408408

409409

410-
if __name__ == '__main__':
411-
tf.test.main()

tensorflow_model_analysis/extractors/labels_extractor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -283,5 +283,3 @@ def check_result(got):
283283
util.assert_that(result, check_result, label='result')
284284

285285

286-
if __name__ == '__main__':
287-
tf.test.main()

tensorflow_model_analysis/extractors/legacy_feature_extractor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -239,5 +239,3 @@ def testMaterializeFeaturesWithExcludes(self):
239239
self.assertNotIn('features__s', result)
240240

241241

242-
if __name__ == '__main__':
243-
tf.test.main()

tensorflow_model_analysis/extractors/legacy_input_extractor_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,3 @@ def check_result(got):
392392
util.assert_that(result, check_result, label='result')
393393

394394

395-
if __name__ == '__main__':
396-
tf.compat.v1.enable_v2_behavior()
397-
tf.test.main()

tensorflow_model_analysis/extractors/legacy_meta_feature_extractor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,3 @@ def testGetSparseTensorValue(self):
188188
)
189189

190190

191-
if __name__ == '__main__':
192-
tf.test.main()

tensorflow_model_analysis/extractors/materialized_predictions_extractor_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,3 @@ def check_result(got):
155155
util.assert_that(result, check_result, label='result')
156156

157157

158-
if __name__ == '__main__':
159-
tf.compat.v1.enable_v2_behavior()
160-
tf.test.main()

tensorflow_model_analysis/extractors/predictions_extractor_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,3 @@ def check_result(got):
513513
util.assert_that(result, check_result)
514514

515515

516-
if __name__ == '__main__':
517-
tf.compat.v1.enable_v2_behavior()
518-
tf.test.main()

tensorflow_model_analysis/extractors/slice_key_extractor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -322,5 +322,3 @@ def check_result(got):
322322
util.assert_that(slice_keys_extracts, check_result)
323323

324324

325-
if __name__ == '__main__':
326-
tf.test.main()

tensorflow_model_analysis/extractors/sql_slice_key_extractor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -423,5 +423,3 @@ def check_result(got):
423423
util.assert_that(result, check_result)
424424

425425

426-
if __name__ == '__main__':
427-
tf.test.main()

tensorflow_model_analysis/extractors/tfjs_predict_extractor_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,3 @@ def check_result(got):
212212
util.assert_that(result, check_result, label='result')
213213

214214

215-
if __name__ == '__main__':
216-
tf.compat.v1.enable_v2_behavior()
217-
tf.test.main()

tensorflow_model_analysis/extractors/tflite_predict_extractor_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,3 @@ def check_result(got):
232232
util.assert_that(result, check_result, label='result')
233233

234234

235-
if __name__ == '__main__':
236-
tf.compat.v1.enable_v2_behavior()
237-
tf.test.main()

tensorflow_model_analysis/extractors/transformed_features_extractor_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,3 @@ def check_result(batches):
311311
util.assert_that(result, check_result, label='result')
312312

313313

314-
if __name__ == '__main__':
315-
tf.compat.v1.enable_v2_behavior()
316-
tf.test.main()

tensorflow_model_analysis/extractors/unbatch_extractor_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -556,5 +556,3 @@ def check_result(got):
556556
util.assert_that(result, check_result, label='result')
557557

558558

559-
if __name__ == '__main__':
560-
tf.test.main()

tensorflow_model_analysis/metrics/aggregation_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -225,5 +225,3 @@ def check_result(got):
225225
util.assert_that(result, check_result, label='result')
226226

227227

228-
if __name__ == '__main__':
229-
tf.test.main()

tensorflow_model_analysis/metrics/attributions_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -531,5 +531,3 @@ def check_result(got):
531531
util.assert_that(result, check_result, label='result')
532532

533533

534-
if __name__ == '__main__':
535-
tf.test.main()

tensorflow_model_analysis/metrics/binary_confusion_matrices_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -575,5 +575,3 @@ def check_result(got):
575575
util.assert_that(result, check_result, label='result')
576576

577577

578-
if __name__ == '__main__':
579-
tf.test.main()

tensorflow_model_analysis/metrics/bleu_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -640,5 +640,3 @@ def check_result(got):
640640
util.assert_that(result['metrics'], check_result, label='result')
641641

642642

643-
if __name__ == '__main__':
644-
tf.test.main()

tensorflow_model_analysis/metrics/calibration_histogram_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -422,5 +422,3 @@ def testRebinWithSparseData(self):
422422
dataclasses.astuple(got[i]), dataclasses.astuple(expected[i]))
423423

424424

425-
if __name__ == '__main__':
426-
tf.test.main()

tensorflow_model_analysis/metrics/calibration_plot_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -440,5 +440,3 @@ def testCalibrationPlotWithSchema(self, eval_config, schema, model_names,
440440
self.assertEqual(expected_range, histogram.combiner._range)
441441

442442

443-
if __name__ == '__main__':
444-
tf.test.main()

tensorflow_model_analysis/metrics/calibration_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,3 @@ def check_result(got):
138138
util.assert_that(result, check_result, label='result')
139139

140140

141-
if __name__ == '__main__':
142-
tf.test.main()

tensorflow_model_analysis/metrics/confusion_matrix_metrics_test.py

-3
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,3 @@ def testConfusionMatrixFeatureSamplers(
11781178
)
11791179

11801180

1181-
if __name__ == '__main__':
1182-
tf.compat.v1.enable_v2_behavior()
1183-
tf.test.main()

tensorflow_model_analysis/metrics/confusion_matrix_plot_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,3 @@ def check_result(got):
160160
util.assert_that(result, check_result, label='result')
161161

162162

163-
if __name__ == '__main__':
164-
tf.test.main()

tensorflow_model_analysis/metrics/cross_entropy_metrics_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -182,5 +182,3 @@ def check_result(got):
182182
util.assert_that(result, check_result, label='result')
183183

184184

185-
if __name__ == '__main__':
186-
absltest.main()

tensorflow_model_analysis/metrics/exact_match_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -124,5 +124,3 @@ def check_result(got):
124124
util.assert_that(result, check_result, label='result')
125125

126126

127-
if __name__ == '__main__':
128-
tf.test.main()

tensorflow_model_analysis/metrics/example_count_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,3 @@ def check_result(got):
166166
util.assert_that(result['metrics'], check_result, label='result')
167167

168168

169-
if __name__ == '__main__':
170-
tf.test.main()

tensorflow_model_analysis/metrics/flip_metrics_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -343,5 +343,3 @@ def check_result(got):
343343
util.assert_that(result, check_result, label='result')
344344

345345

346-
if __name__ == '__main__':
347-
absltest.main()

tensorflow_model_analysis/metrics/mean_regression_error_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -231,5 +231,3 @@ def check_result(got):
231231
util.assert_that(result, check_result, label='result')
232232

233233

234-
if __name__ == '__main__':
235-
absltest.main()

tensorflow_model_analysis/metrics/metric_specs_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -694,5 +694,3 @@ def testToComputationsWithMixedAggregationAndNonAggregationMetrics(self):
694694
self.assertLen(computations, 3)
695695

696696

697-
if __name__ == '__main__':
698-
tf.test.main()

tensorflow_model_analysis/metrics/metric_types_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -240,5 +240,3 @@ def testMultiModelMultiOutputPreprocessors(self):
240240
})
241241

242242

243-
if __name__ == '__main__':
244-
tf.test.main()

tensorflow_model_analysis/metrics/metric_util_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -908,5 +908,3 @@ def testTopKIndicesWithBinaryClassification(self):
908908
self.assertAllClose(scores[got], np.array([0.8]))
909909

910910

911-
if __name__ == '__main__':
912-
tf.test.main()

tensorflow_model_analysis/metrics/min_label_position_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -215,5 +215,3 @@ def check_result(got):
215215
util.assert_that(result, check_result, label='result')
216216

217217

218-
if __name__ == '__main__':
219-
tf.test.main()

tensorflow_model_analysis/metrics/model_cosine_similarity_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,3 @@ def check_result(got):
150150
util.assert_that(result, check_result, label='result')
151151

152152

153-
if __name__ == '__main__':
154-
absltest.main()

tensorflow_model_analysis/metrics/multi_class_confusion_matrix_metrics_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -403,5 +403,3 @@ def check_result(got):
403403
util.assert_that(result, check_result, label='result')
404404

405405

406-
if __name__ == '__main__':
407-
tf.test.main()

tensorflow_model_analysis/metrics/multi_class_confusion_matrix_plot_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -333,5 +333,3 @@ def check_result(got):
333333
util.assert_that(result, check_result, label='result')
334334

335335

336-
if __name__ == '__main__':
337-
tf.test.main()

tensorflow_model_analysis/metrics/multi_label_confusion_matrix_plot_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -330,5 +330,3 @@ def check_result(got):
330330
util.assert_that(result, check_result, label='result')
331331

332332

333-
if __name__ == '__main__':
334-
tf.test.main()

tensorflow_model_analysis/metrics/ndcg_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,3 @@ def check_result(got):
170170
util.assert_that(result, check_result, label='result')
171171

172172

173-
if __name__ == '__main__':
174-
tf.test.main()

tensorflow_model_analysis/metrics/object_detection_confusion_matrix_metrics_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,3 @@ def check_result(got):
196196
util.assert_that(result['metrics'], check_result, label='result')
197197

198198

199-
if __name__ == '__main__':
200-
absltest.main()

tensorflow_model_analysis/metrics/object_detection_confusion_matrix_plot_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,3 @@ def check_result(got):
185185
util.assert_that(result['plots'], check_result, label='result')
186186

187187

188-
if __name__ == '__main__':
189-
absltest.main()

tensorflow_model_analysis/metrics/object_detection_metrics_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -368,5 +368,3 @@ def check_result(got):
368368
util.assert_that(result['metrics'], check_result, label='result')
369369

370370

371-
if __name__ == '__main__':
372-
absltest.main()

tensorflow_model_analysis/metrics/prediction_difference_metrics_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,3 @@ def check_result(got):
180180
util.assert_that(result, check_result, label='result')
181181

182182

183-
if __name__ == '__main__':
184-
absltest.main()

tensorflow_model_analysis/metrics/preprocessors/image_preprocessors_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,3 @@ def testLabelPreidictionImageSizeMismatch(self):
165165
)
166166

167167

168-
if __name__ == '__main__':
169-
absltest.main()

tensorflow_model_analysis/metrics/preprocessors/invert_logarithm_preprocessors_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,3 @@ def testLabelPreidictionSizeMismatch(self):
126126
)
127127

128128

129-
if __name__ == '__main__':
130-
absltest.main()

tensorflow_model_analysis/metrics/preprocessors/object_detection_preprocessors_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -333,5 +333,3 @@ def check_result(result):
333333
beam_testing_util.assert_that(updated_pcoll, check_result)
334334

335335

336-
if __name__ == '__main__':
337-
absltest.main()

tensorflow_model_analysis/metrics/preprocessors/set_match_preprocessors_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -389,5 +389,3 @@ def testMismatchClassesAndScores(self):
389389
)
390390

391391

392-
if __name__ == '__main__':
393-
absltest.main()

tensorflow_model_analysis/metrics/preprocessors/utils/bounding_box_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,3 @@ def test_input_check_sort_boxes_by_confidence(self):
8585
np.array([20, 60, 290]))
8686

8787

88-
if __name__ == '__main__':
89-
absltest.main()

tensorflow_model_analysis/metrics/preprocessors/utils/box_match_test.py

-2
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,3 @@ def test_boxes_to_label_prediction_filter(self, raw_input, expected_result):
192192
np.testing.assert_allclose(result[2], expected_result['example_weights'])
193193

194194

195-
if __name__ == '__main__':
196-
absltest.main()

0 commit comments

Comments
 (0)