Rename TensorFlow Privacy Python tests to have the name foo_test.

* Renamed Python test.
* Fixed usage of deprecated `assertRaisesRegexp`.

Python tooling pattern matches on file name, so it is important for tests to end with the suffix "_test" in order to interact with such tooling well.

In this case, these test are getting lint errors they should not and not getting lint errors they should.

PiperOrigin-RevId: 424433864
This commit is contained in:
Michael Reneer 2022-01-26 13:48:00 -08:00 committed by A. Unique TensorFlower
parent 75f88f8120
commit 1424cb2418
2 changed files with 2 additions and 2 deletions

View file

@ -41,7 +41,7 @@ class TensorBufferTest(tf.test.TestCase):
self.assertAllEqual(my_buffer.values.numpy(), [value1, value2]) self.assertAllEqual(my_buffer.values.numpy(), [value1, value2])
def test_fail_on_scalar(self): def test_fail_on_scalar(self):
with self.assertRaisesRegexp(ValueError, 'Shape cannot be scalar.'): with self.assertRaisesRegex(ValueError, 'Shape cannot be scalar.'):
tensor_buffer.TensorBuffer(1, ()) tensor_buffer.TensorBuffer(1, ())
def test_fail_on_inconsistent_shape(self): def test_fail_on_inconsistent_shape(self):
@ -49,7 +49,7 @@ class TensorBufferTest(tf.test.TestCase):
my_buffer = tensor_buffer.TensorBuffer(size, shape, name='my_buffer') my_buffer = tensor_buffer.TensorBuffer(size, shape, name='my_buffer')
with self.assertRaisesRegexp( with self.assertRaisesRegex(
tf.errors.InvalidArgumentError, tf.errors.InvalidArgumentError,
'Appending value of inconsistent shape.'): 'Appending value of inconsistent shape.'):
my_buffer.append(tf.ones(shape=[3, 4], dtype=tf.int32)) my_buffer.append(tf.ones(shape=[3, 4], dtype=tf.int32))