diff --git a/tensorboard/compat/tensorflow_stub/io/gfile_fsspec_test.py b/tensorboard/compat/tensorflow_stub/io/gfile_fsspec_test.py index cd519eab48e..3f832539776 100644 --- a/tensorboard/compat/tensorflow_stub/io/gfile_fsspec_test.py +++ b/tensorboard/compat/tensorflow_stub/io/gfile_fsspec_test.py @@ -464,7 +464,7 @@ def testJoin(self): def testComplexChaining(self): path = "simplecache::zip://*::file://banana/bar" - with self.assertRaisesRegexp( + with self.assertRaisesRegex( errors.InvalidArgumentError, "fsspec URL must only have paths in the last chained filesystem", ): diff --git a/tensorboard/data/experimental/experiment_from_dev_test.py b/tensorboard/data/experimental/experiment_from_dev_test.py index 79136427bc1..13f5ce2de95 100644 --- a/tensorboard/data/experimental/experiment_from_dev_test.py +++ b/tensorboard/data/experimental/experiment_from_dev_test.py @@ -199,7 +199,7 @@ def stream_experiment_data(request, **kwargs): lambda api_endpoint: mock_api_client, ): experiment = experiment_from_dev.ExperimentFromDev("789") - with self.assertRaisesRegexp( + with self.assertRaisesRegex( ValueError, r"contains missing value\(s\).*different sets of " r"steps.*pivot=False", diff --git a/tensorboard/lazy_test.py b/tensorboard/lazy_test.py index 9dd57bb06f2..50e65af8f85 100644 --- a/tensorboard/lazy_test.py +++ b/tensorboard/lazy_test.py @@ -64,7 +64,7 @@ def test_repr_before_load(self): def foo(): self.fail("Should not need to resolve this module.") - self.assertEquals( + self.assertEqual( repr(foo), "" ) @@ -76,7 +76,7 @@ def foo(): return collections foo.namedtuple - self.assertEquals( + self.assertEqual( repr(foo), "<%r via LazyModule (loaded)>" % collections ) diff --git a/tensorboard/plugins/debugger_v2/debugger_v2_plugin_test.py b/tensorboard/plugins/debugger_v2/debugger_v2_plugin_test.py index 45bf9c44b4f..3c2a32935cc 100644 --- a/tensorboard/plugins/debugger_v2/debugger_v2_plugin_test.py +++ b/tensorboard/plugins/debugger_v2/debugger_v2_plugin_test.py @@ -1646,7 +1646,7 @@ def testServeStackFramesWithMissingStackFrameIdParamErrors(self): self.assertEqual( "application/json", response.headers.get("content-type") ) - self.assertRegexpMatches( + self.assertRegex( json.loads(response.get_data())["error"], "Not found: Cannot find stack frame with ID" ".*nonsense-stack-frame-id.*", diff --git a/tensorboard/plugins/hparams/list_session_groups_test.py b/tensorboard/plugins/hparams/list_session_groups_test.py index c6dee1638c4..4219f98c1ce 100644 --- a/tensorboard/plugins/hparams/list_session_groups_test.py +++ b/tensorboard/plugins/hparams/list_session_groups_test.py @@ -583,7 +583,7 @@ def test_no_allowed_statuses(self): aggregation_type: AGGREGATION_AVG """ response = self._run_handler(request) - self.assertEquals(len(response.session_groups), 0) + self.assertEqual(len(response.session_groups), 0) def test_some_allowed_statuses(self): request = """ @@ -593,7 +593,7 @@ def test_some_allowed_statuses(self): aggregation_type: AGGREGATION_AVG """ response = self._run_handler(request) - self.assertEquals( + self.assertEqual( _reduce_to_names(response.session_groups), [ ("group_1", ["session_1"]), @@ -610,7 +610,7 @@ def test_some_allowed_statuses_empty_groups(self): aggregation_type: AGGREGATION_AVG """ response = self._run_handler(request) - self.assertEquals( + self.assertEqual( _reduce_to_names(response.session_groups), [("group_2", ["session_3"])], ) @@ -629,7 +629,7 @@ def test_aggregation_median_current_temp(self): aggregation_metric: { tag: "current_temp" } """ response = self._run_handler(request) - self.assertEquals(len(response.session_groups[1].metric_values), 2) + self.assertEqual(len(response.session_groups[1].metric_values), 2) self.assertProtoEquals( """ name { tag: "current_temp" } @@ -663,7 +663,7 @@ def test_aggregation_median_delta_temp(self): aggregation_metric: { tag: "delta_temp" } """ response = self._run_handler(request) - self.assertEquals(len(response.session_groups[1].metric_values), 2) + self.assertEqual(len(response.session_groups[1].metric_values), 2) self.assertProtoEquals( """ name { tag: "current_temp" } @@ -697,7 +697,7 @@ def test_aggregation_max_current_temp(self): aggregation_metric: { tag: "current_temp" } """ response = self._run_handler(request) - self.assertEquals(len(response.session_groups[1].metric_values), 2) + self.assertEqual(len(response.session_groups[1].metric_values), 2) self.assertProtoEquals( """ name { tag: "current_temp" } @@ -731,7 +731,7 @@ def test_aggregation_max_delta_temp(self): aggregation_metric: { tag: "delta_temp" } """ response = self._run_handler(request) - self.assertEquals(len(response.session_groups[1].metric_values), 2) + self.assertEqual(len(response.session_groups[1].metric_values), 2) self.assertProtoEquals( """ name { tag: "current_temp" } @@ -765,7 +765,7 @@ def test_aggregation_min_current_temp(self): aggregation_metric: { tag: "current_temp" } """ response = self._run_handler(request) - self.assertEquals(len(response.session_groups[1].metric_values), 2) + self.assertEqual(len(response.session_groups[1].metric_values), 2) self.assertProtoEquals( """ name { tag: "current_temp" } @@ -799,7 +799,7 @@ def test_aggregation_min_delta_temp(self): aggregation_metric: { tag: "delta_temp" } """ response = self._run_handler(request) - self.assertEquals(len(response.session_groups[1].metric_values), 2) + self.assertEqual(len(response.session_groups[1].metric_values), 2) self.assertProtoEquals( """ name { tag: "current_temp" } diff --git a/tensorboard/plugins/mesh/demo_utils_test.py b/tensorboard/plugins/mesh/demo_utils_test.py index 6988c0535e8..1a8c8a11748 100644 --- a/tensorboard/plugins/mesh/demo_utils_test.py +++ b/tensorboard/plugins/mesh/demo_utils_test.py @@ -35,7 +35,7 @@ def test_parse_vertex(self): def test_prase_vertex_expects_colors(self): """Tests that method will throw error if color is not poresent.""" - with self.assertRaisesRegexp( + with self.assertRaisesRegex( ValueError, "PLY file must contain vertices with colors" ): demo_utils._parse_vertex("1 2 3") diff --git a/tensorboard/uploader/exporter_test.py b/tensorboard/uploader/exporter_test.py index a7354b57ecf..5e989ede416 100644 --- a/tensorboard/uploader/exporter_test.py +++ b/tensorboard/uploader/exporter_test.py @@ -729,7 +729,7 @@ def stream_experiment_data(request, **kwargs): # experiment_id. with self.assertRaises(exporter_lib.GrpcTimeoutException) as cm: next(generator) - self.assertEquals(cm.exception.experiment_id, experiment_id) + self.assertEqual(cm.exception.experiment_id, experiment_id) def test_stream_experiment_data_passes_through_unexpected_exception(self): # Setup: Client where: @@ -758,7 +758,7 @@ def stream_experiment_data(request, **kwargs): # Expect: The internal error is passed through. with self.assertRaises(grpc.RpcError) as cm: next(generator) - self.assertEquals(cm.exception.details(), "details string") + self.assertEqual(cm.exception.details(), "details string") def test_handles_outdir_with_no_slash(self): oldcwd = os.getcwd() diff --git a/tensorboard/uploader/uploader_subcommand_test.py b/tensorboard/uploader/uploader_subcommand_test.py index 4b0eb43d4ce..8b23fe97210 100644 --- a/tensorboard/uploader/uploader_subcommand_test.py +++ b/tensorboard/uploader/uploader_subcommand_test.py @@ -227,7 +227,7 @@ def testListIntentSetsExperimentMask(self): actual_mask = exporter_lib.list_experiments.call_args[1][ "fieldmask" ] - self.assertEquals(actual_mask, expected_mask) + self.assertEqual(actual_mask, expected_mask) if __name__ == "__main__": diff --git a/tensorboard/uploader/uploader_test.py b/tensorboard/uploader/uploader_test.py index d628f943dfc..db9d7d48f4c 100644 --- a/tensorboard/uploader/uploader_test.py +++ b/tensorboard/uploader/uploader_test.py @@ -1472,7 +1472,7 @@ def test_histogram_event_with_empty_tensor_content_errors_out(self): mock_client = _create_mock_client() sender = _create_tensor_request_sender("123", mock_client) - with self.assertRaisesRegexp( + with self.assertRaisesRegex( ValueError, re.compile( r"failed to upload a tensor.*malformation.*tag.*\'one\'.*step.*42", @@ -1493,7 +1493,7 @@ def test_histogram_event_with_incorrect_tensor_shape_errors_out(self): mock_client = _create_mock_client() sender = _create_tensor_request_sender("123", mock_client) - with self.assertRaisesRegexp( + with self.assertRaisesRegex( ValueError, re.compile( r"failed to upload a tensor.*malformation.*tag.*\'two\'.*step.*1337."