Skip to content

Commit

Permalink
Remove if __name__ == "__main__": from test files
Browse files Browse the repository at this point in the history
  • Loading branch information
smokestacklightnin committed Aug 16, 2024
1 parent f305a18 commit ab5f4f8
Show file tree
Hide file tree
Showing 39 changed files with 0 additions and 78 deletions.
2 changes: 0 additions & 2 deletions tensorflow_transform/analyzers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,5 +624,3 @@ def testMinDiffFromAvg(self):
analyzers.calculate_recommended_min_diff_from_avg(100000000), 25)


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/annotators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,3 @@ def preprocessing_fn():
self.assertEqual(trackable_object, object_tracker.trackable_objects[0])


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/analysis_graph_builder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,5 +579,3 @@ class _Analyzer(
structured_outputs)


if __name__ == '__main__':
tft_unit.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/analyzer_cache_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,3 @@ def expand(self, pbegin):
beam_test_util.equal_to([test_cache_dict[key].cache_dict['b']]))


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/analyzer_impls_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,3 @@ def testJoinBoundarieRows(self, input_boundaries, expected_boundaries,
self.assertAllEqual(num_buckets, expected_num_buckets)


if __name__ == '__main__':
tft_unit.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/annotators_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,3 @@ def preprocessing_fn(inputs):
)


if __name__ == '__main__':
tft_unit.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/bucketize_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,5 +888,3 @@ def testBucketizationSpecificDistribution(self):
inputs, expected_boundaries, tf.float32, num_buckets=5)


if __name__ == '__main__':
tft_unit.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/cached_impl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1749,5 +1749,3 @@ def preprocessing_fn(inputs):
)


if __name__ == '__main__':
tft_unit.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/combiner_packing_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,5 +433,3 @@ def _side_effect_fn(saved_model_future, cache_value_nodes,
second=expected_dot_graph_str_after_packing)


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/context_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,3 @@ def testNestedContextCreateBaseTempDir(self):
tft_beam.Context.create_base_temp_dir()


if __name__ == '__main__':
tft_unit.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/deep_copy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,5 +330,3 @@ def testDeepCopyTags(self):
self.assertEqual(DeepCopyTest._counts['Add2'], 3 * (num_copies + 1))
self.assertEqual(DeepCopyTest._counts['Add3'], 3)

if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/impl_output_record_batches_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,5 +199,3 @@ def testConvertToLargeRecordBatch(
self.assertGreater(actual_num_batches, 1)


if __name__ == '__main__':
tft_unit.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/impl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4797,5 +4797,3 @@ def test_preprocessing_fn_returns_wrong_type(self):
expected_data=None)


if __name__ == '__main__':
tft_unit.main()
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,3 @@ def mock_write_metadata(metadata, path):
self.assertEqual(metadata, test_metadata.COMPLETE_METADATA)


if __name__ == '__main__':
tf.test.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/tft_beam_io/transform_fn_io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,3 @@ def mock_copy_tree_to_unique_temp_dir(source, base_temp_dir_path):
self.assertEqual(2, len(file_io.list_directory(transform_output_dir)))


if __name__ == '__main__':
tf.test.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/tukey_hh_params_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,5 +627,3 @@ def assert_and_cast_dtype(tensor):
# Runs the test deterministically on the whole batch.
beam_pipeline=beam.Pipeline())

if __name__ == '__main__':
tft_unit.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/beam/vocabulary_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2088,5 +2088,3 @@ def preprocessing_fn(inputs):
)


if __name__ == '__main__':
tft_unit.main()
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@ def _VocabFormat(self):
return 'tfrecord_gzip'


if __name__ == '__main__':
tft_unit.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/coders/csv_coder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,5 +292,3 @@ def test_picklable(self):
self.assertEqual(coder.encode(instance), csv_line.encode('utf-8'))


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/coders/example_proto_coder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,5 +406,3 @@ def test_example_proto_coder_cache(self):
self.assertSerializedProtosEqual(coder.encode(instance), serialized_proto)


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,3 @@ def fn2():
self.assertAllEqual([], graph.get_collection("another_collection"))


if __name__ == "__main__":
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/gaussianization_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,5 +252,3 @@ def test_inverse_tukey_hh(self, samples, hl, hr, expected_output):
self.assertAllClose(output, expected_output)


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/graph_tools_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1264,5 +1264,3 @@ def _value_to_matcher(value, add_quotes=False):
type(value), value))


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/impl_helper_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,5 +974,3 @@ def iteration(counter, x_minus_counter):
cond=stop_condition, body=iteration, loop_vars=initial_values)[1]


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/info_theory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,3 @@ def test_mutual_information(self, cell_count, row_count, col_count,
self.assertNear(per_cell_mi, expected_mi, EPSILON)


if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/inspect_preprocessing_fn_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,3 @@ def test_column_inference(self, preprocessing_fn,
expected_transform_input_columns)


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/mappers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,5 +931,3 @@ def testEstimatedProbabilityDensityMissingKey(self):
self.assertAllEqual(expected, sess.run(result))


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/nodes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,3 @@ def testGetDotGraph(self):
msg='Result dot graph is:\n{}'.format(dot_string))


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/pretrained_models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,3 @@ def testApplyFunctionWithCheckpointTwoInputs(self):
self.assertAllEqual(output_value, [-1, 2, 5])


if __name__ == '__main__':
tf.test.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/saved/saved_model_loader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,3 @@ def setUpClass(cls):

# This class has no tests at the moment.

if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/saved/saved_transform_io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,5 +305,3 @@ def test_stale_asset_collections_are_cleaned(self):
saved_transform_io.write_saved_transform_from_session(
session, inputs, outputs, export_path)

if __name__ == '__main__':
tf.test.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/saved/saved_transform_io_v2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,5 +666,3 @@ def func(inputs):
self.assertEqual(restored_function(**input_kwargs)['a+b'], expected_output)


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/schema_inference_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,5 +402,3 @@ def preprocessing_fn(_):
self.assertProtoEquals(expected_schema, schema)


if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/test_case_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,3 @@ def testSampleParametrizedTestMethod(self, my_arg, my_other_arg):
self.assertIn((my_arg, my_other_arg), {(1, 'a'), (2, 'b')})


if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/tf2_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,3 @@ def foo(inputs):
self.assertEqual(result['x_2'].dtype, dtype)


if __name__ == '__main__':
test_case.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/tf_metadata/dataset_metadata_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,3 @@ def test_sanity(self):
self.assertEqual(metadata.schema, test_common.get_test_schema())


if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/tf_metadata/metadata_io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,3 @@ def test_write_and_read(self):
self.assertEqual(original, reloaded)


if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/tf_metadata/schema_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,3 @@ def test_pop_ragged_source_columns(self, name, tensor_representation,
self.assertEqual(feature_by_name, truncated_feature_by_name)


if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletions tensorflow_transform/tf_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2521,5 +2521,3 @@ def foo(input_tensor):
self.assertAllEqual(output_tensor, expected_data)


if __name__ == '__main__':
test_case.main()

0 comments on commit ab5f4f8

Please sign in to comment.