From f0547d3c9a029826aa04977a189917c16f7dbb58 Mon Sep 17 00:00:00 2001 From: Matej Aleksandrov Date: Tue, 17 Nov 2026 05:43:21 -0800 Subject: [PATCH] Migrate usage of mock to unittest.mock PiperOrigin-RevId: 1023661983 --- .../python/core/internal/tensor_encoding/core/BUILD | 1 - .../core/internal/tensor_encoding/core/encoding_stage_test.py | 3 ++- .../python/core/internal/tensor_encoding/testing/BUILD | 1 - .../core/internal/tensor_encoding/testing/test_utils_test.py | 3 ++- tensorflow_model_optimization/python/core/keras/BUILD | 1 - .../python/core/keras/metrics_test.py | 3 ++- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/BUILD b/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/BUILD index 712371977..226c280d0 100644 --- a/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/BUILD +++ b/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/BUILD @@ -67,7 +67,6 @@ py_test( ":encoding_stage", # absl/testing:parameterized dep1, # google/protobuf:use_fast_cpp_protos dep1, # Automatically added - # mock dep1, # numpy dep1, # tensorflow dep1, "//tensorflow_model_optimization/python/core/internal/tensor_encoding/testing:test_utils", diff --git a/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/encoding_stage_test.py b/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/encoding_stage_test.py index c4004fb95..a7b874f1e 100644 --- a/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/encoding_stage_test.py +++ b/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/encoding_stage_test.py @@ -16,8 +16,9 @@ from __future__ import division from __future__ import print_function +from unittest import mock + from absl.testing import parameterized -import mock import numpy as np import tensorflow as tf diff --git a/tensorflow_model_optimization/python/core/internal/tensor_encoding/testing/BUILD b/tensorflow_model_optimization/python/core/internal/tensor_encoding/testing/BUILD index b1ac72f11..014538ce9 100644 --- a/tensorflow_model_optimization/python/core/internal/tensor_encoding/testing/BUILD +++ b/tensorflow_model_optimization/python/core/internal/tensor_encoding/testing/BUILD @@ -42,7 +42,6 @@ py_test( ":test_utils", # absl/testing:parameterized dep1, # google/protobuf:use_fast_cpp_protos dep1, # Automatically added - # mock dep1, # numpy dep1, # six dep1, # tensorflow dep1, diff --git a/tensorflow_model_optimization/python/core/internal/tensor_encoding/testing/test_utils_test.py b/tensorflow_model_optimization/python/core/internal/tensor_encoding/testing/test_utils_test.py index fa5fc201f..47753837a 100644 --- a/tensorflow_model_optimization/python/core/internal/tensor_encoding/testing/test_utils_test.py +++ b/tensorflow_model_optimization/python/core/internal/tensor_encoding/testing/test_utils_test.py @@ -16,8 +16,9 @@ from __future__ import division from __future__ import print_function +from unittest import mock + from absl.testing import parameterized -import mock import numpy as np from six.moves import range from six.moves import zip diff --git a/tensorflow_model_optimization/python/core/keras/BUILD b/tensorflow_model_optimization/python/core/keras/BUILD index 9273eb0e3..39aead731 100644 --- a/tensorflow_model_optimization/python/core/keras/BUILD +++ b/tensorflow_model_optimization/python/core/keras/BUILD @@ -69,7 +69,6 @@ py_test( ":compat", ":metrics", # google/protobuf:use_fast_cpp_protos dep1, # Automatically added - # mock dep1, # tensorflow dep1, # python/eager:monitoring tensorflow dep2, ], diff --git a/tensorflow_model_optimization/python/core/keras/metrics_test.py b/tensorflow_model_optimization/python/core/keras/metrics_test.py index b42c518f2..b45dfa349 100644 --- a/tensorflow_model_optimization/python/core/keras/metrics_test.py +++ b/tensorflow_model_optimization/python/core/keras/metrics_test.py @@ -14,7 +14,8 @@ # ============================================================================== """Tests for Metrics.""" -import mock +from unittest import mock + import tensorflow as tf from tensorflow.python.eager import monitoring