diff --git a/keras_hub/src/layers/preprocessing/masked_lm_mask_generator_test.py b/keras_hub/src/layers/preprocessing/masked_lm_mask_generator_test.py index f3e58d3133..6b03f54d11 100644 --- a/keras_hub/src/layers/preprocessing/masked_lm_mask_generator_test.py +++ b/keras_hub/src/layers/preprocessing/masked_lm_mask_generator_test.py @@ -148,7 +148,7 @@ def test_config(self): "vocabulary_size": self.vocabulary_size, "unselectable_token_ids": unselectable_token_ids, } - self.assertDictContainsSubset(expected_config, config) + self.assertEqual(config, {**config, **expected_config}) # Test cloned masked_lm_masker can be run. cloned_masked_lm_masker = MaskedLMMaskGenerator.from_config(config) diff --git a/keras_hub/src/models/efficientnet/cba_test.py b/keras_hub/src/models/efficientnet/cba_test.py index ec028b1239..e9ea31ccbe 100644 --- a/keras_hub/src/models/efficientnet/cba_test.py +++ b/keras_hub/src/models/efficientnet/cba_test.py @@ -10,7 +10,7 @@ def test_same_input_output_shapes(self): layer = CBABlock(input_filters=32, output_filters=32) output = layer(inputs) - self.assertEquals(output.shape, (1, 64, 64, 32)) + self.assertEqual(output.shape, (1, 64, 64, 32)) self.assertLen(output, 1) def test_different_input_output_shapes(self): @@ -18,5 +18,5 @@ def test_different_input_output_shapes(self): layer = CBABlock(input_filters=32, output_filters=48) output = layer(inputs) - self.assertEquals(output.shape, (1, 64, 64, 48)) + self.assertEqual(output.shape, (1, 64, 64, 48)) self.assertLen(output, 1) diff --git a/keras_hub/src/models/efficientnet/efficientnet_backbone_test.py b/keras_hub/src/models/efficientnet/efficientnet_backbone_test.py index c11e636540..1f54f71925 100644 --- a/keras_hub/src/models/efficientnet/efficientnet_backbone_test.py +++ b/keras_hub/src/models/efficientnet/efficientnet_backbone_test.py @@ -87,24 +87,24 @@ def test_feature_pyramid_outputs(self): height = width = 256 outputs = model(keras.ops.ones(shape=(batch_size, height, width, 3))) levels = ["P1", "P2", "P3", "P4", "P5"] - self.assertEquals(list(outputs.keys()), levels) - self.assertEquals( + self.assertEqual(list(outputs.keys()), levels) + self.assertEqual( outputs["P1"].shape, (batch_size, height // 2**1, width // 2**1, 24), ) - self.assertEquals( + self.assertEqual( outputs["P2"].shape, (batch_size, height // 2**2, width // 2**2, 48), ) - self.assertEquals( + self.assertEqual( outputs["P3"].shape, (batch_size, height // 2**3, width // 2**3, 64), ) - self.assertEquals( + self.assertEqual( outputs["P4"].shape, (batch_size, height // 2**4, width // 2**4, 160), ) - self.assertEquals( + self.assertEqual( outputs["P5"].shape, (batch_size, height // 2**5, width // 2**5, 1280), ) diff --git a/keras_hub/src/models/efficientnet/fusedmbconv_test.py b/keras_hub/src/models/efficientnet/fusedmbconv_test.py index b12f729ddc..a3049dc462 100644 --- a/keras_hub/src/models/efficientnet/fusedmbconv_test.py +++ b/keras_hub/src/models/efficientnet/fusedmbconv_test.py @@ -10,7 +10,7 @@ def test_same_input_output_shapes(self): layer = FusedMBConvBlock(input_filters=32, output_filters=32) output = layer(inputs) - self.assertEquals(output.shape, (1, 64, 64, 32)) + self.assertEqual(output.shape, (1, 64, 64, 32)) self.assertLen(output, 1) def test_different_input_output_shapes(self): @@ -18,7 +18,7 @@ def test_different_input_output_shapes(self): layer = FusedMBConvBlock(input_filters=32, output_filters=48) output = layer(inputs) - self.assertEquals(output.shape, (1, 64, 64, 48)) + self.assertEqual(output.shape, (1, 64, 64, 48)) self.assertLen(output, 1) def test_squeeze_excitation_ratio(self): @@ -28,5 +28,5 @@ def test_squeeze_excitation_ratio(self): ) output = layer(inputs) - self.assertEquals(output.shape, (1, 64, 64, 48)) + self.assertEqual(output.shape, (1, 64, 64, 48)) self.assertLen(output, 1) diff --git a/keras_hub/src/models/efficientnet/mbconv_test.py b/keras_hub/src/models/efficientnet/mbconv_test.py index ea92c7a9c6..b1085770d4 100644 --- a/keras_hub/src/models/efficientnet/mbconv_test.py +++ b/keras_hub/src/models/efficientnet/mbconv_test.py @@ -10,7 +10,7 @@ def test_same_input_output_shapes(self): layer = MBConvBlock(input_filters=32, output_filters=32) output = layer(inputs) - self.assertEquals(output.shape, (1, 64, 64, 32)) + self.assertEqual(output.shape, (1, 64, 64, 32)) self.assertLen(output, 1) def test_different_input_output_shapes(self): @@ -18,7 +18,7 @@ def test_different_input_output_shapes(self): layer = MBConvBlock(input_filters=32, output_filters=48) output = layer(inputs) - self.assertEquals(output.shape, (1, 64, 64, 48)) + self.assertEqual(output.shape, (1, 64, 64, 48)) self.assertLen(output, 1) def test_squeeze_excitation_ratio(self): @@ -26,5 +26,5 @@ def test_squeeze_excitation_ratio(self): layer = MBConvBlock(input_filters=32, output_filters=48, se_ratio=0.25) output = layer(inputs) - self.assertEquals(output.shape, (1, 64, 64, 48)) + self.assertEqual(output.shape, (1, 64, 64, 48)) self.assertLen(output, 1) diff --git a/keras_hub/src/tests/test_case.py b/keras_hub/src/tests/test_case.py index 8053fff63b..54155e0517 100644 --- a/keras_hub/src/tests/test_case.py +++ b/keras_hub/src/tests/test_case.py @@ -479,7 +479,7 @@ def run_backbone_test( # Check name maps to classname. name = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", cls.__name__) name = re.sub("([a-z])([A-Z])", r"\1_\2", name).lower() - self.assertRegexpMatches(backbone.name, name) + self.assertRegex(backbone.name, name) # Check mixed precision. if run_mixed_precision_check: