Skip to content

Commit

Permalink
cleanup of deprecated test methods
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 716071485
  • Loading branch information
TensorFlow Recommenders Authors committed Jan 16, 2025
1 parent c60e42e commit 7912cc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def test_one_input(self):
self.assertAllClose(np.asarray([[0.16, 0.32, 0.48]]), output)

def test_unsupported_input_dim(self):
with self.assertRaisesRegexp(ValueError,
with self.assertRaisesRegex(ValueError,
r"dimension mismatch"):
x0 = np.random.random((12, 5))
x = np.random.random((12, 7))
layer = Cross()
layer(x0, x)

def test_invalid_diag_scale(self):
with self.assertRaisesRegexp(ValueError,
with self.assertRaisesRegex(ValueError,
r"`diag_scale` should be non-negative"):
x0 = np.asarray([[0.1, 0.2, 0.3]]).astype(np.float32)
x = np.asarray([[0.4, 0.5, 0.6]]).astype(np.float32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_valid_input(self):
f13, f23, 0]]), output)

def test_non_matching_dimensions(self):
with self.assertRaisesRegexp(ValueError, r"dimensions must be equal"):
with self.assertRaisesRegex(ValueError, r"dimensions must be equal"):
feature1 = np.asarray([[0.1, 0.2, 0.3]]).astype(np.float32)
feature2 = np.asarray([[2.0, -1.0, 1.0]]).astype(np.float32)
feature3 = np.asarray([[0.0, 1.0]]).astype(np.float32)
Expand Down

0 comments on commit 7912cc1

Please sign in to comment.