Skip to content

Commit 20840a5

Browse files
jblespiaucopybara-github
authored andcommitted
Remove usages of tsl::Status::error_message.
PiperOrigin-RevId: 524913975 Change-Id: I8ed1037dfb6de7d0f88ca826d3d231ec6d1ebe03
1 parent d80e10a commit 20840a5

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

tensorflow_compression/cc/kernels/range_coding_kernels_test.cc

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ TEST_F(RangeCoderOpsTest, InvalidCdfShape) {
329329
{
330330
const Status status = RunEncodeOp(10, {data, cdf}, &unused);
331331
EXPECT_FALSE(status.ok());
332-
EXPECT_NE(status.error_message().find("`cdf` should have one more axis"),
332+
EXPECT_NE(status.ToString().find("`cdf` should have one more axis"),
333333
std::string::npos);
334334
}
335335

@@ -339,24 +339,22 @@ TEST_F(RangeCoderOpsTest, InvalidCdfShape) {
339339
{
340340
const Status status = RunDecodeOp(10, {empty, shape, cdf}, &unused);
341341
EXPECT_FALSE(status.ok());
342-
EXPECT_NE(status.error_message().find("`cdf` should have one more axis"),
342+
EXPECT_NE(status.ToString().find("`cdf` should have one more axis"),
343343
std::string::npos);
344344
}
345345

346346
cdf = Tensor{DT_INT32, {3, 3, 1}};
347347
{
348348
const Status status = RunEncodeOp(10, {data, cdf}, &unused);
349349
EXPECT_FALSE(status.ok());
350-
EXPECT_NE(
351-
status.error_message().find("last dimension of `cdf` should be > 1"),
352-
std::string::npos);
350+
EXPECT_NE(status.ToString().find("last dimension of `cdf` should be > 1"),
351+
std::string::npos);
353352
}
354353
{
355354
const Status status = RunDecodeOp(10, {empty, shape, cdf}, &unused);
356355
EXPECT_FALSE(status.ok());
357-
EXPECT_NE(
358-
status.error_message().find("last dimension of `cdf` should be > 1"),
359-
std::string::npos);
356+
EXPECT_NE(status.ToString().find("last dimension of `cdf` should be > 1"),
357+
std::string::npos);
360358
}
361359
}
362360

@@ -405,7 +403,7 @@ TEST_F(RangeCoderOpsTest, InvalidBroadcast) {
405403
{
406404
const Status status = RunEncodeOp(10, {data, cdf}, &unused);
407405
EXPECT_FALSE(status.ok());
408-
EXPECT_NE(status.error_message().find("Cannot broadcast shape"),
406+
EXPECT_NE(status.ToString().find("Cannot broadcast shape"),
409407
std::string::npos);
410408
}
411409

@@ -417,7 +415,7 @@ TEST_F(RangeCoderOpsTest, InvalidBroadcast) {
417415
{
418416
const Status status = RunDecodeOp(10, {empty, shape, cdf}, &unused);
419417
EXPECT_FALSE(status.ok());
420-
EXPECT_NE(status.error_message().find("Cannot broadcast shape"),
418+
EXPECT_NE(status.ToString().find("Cannot broadcast shape"),
421419
std::string::npos);
422420
}
423421

@@ -427,8 +425,7 @@ TEST_F(RangeCoderOpsTest, InvalidBroadcast) {
427425
{
428426
const Status status = RunEncodeOp(10, {data, cdf}, &unused);
429427
EXPECT_FALSE(status.ok());
430-
EXPECT_NE(status.error_message().find("Irregular broadcast"),
431-
std::string::npos);
428+
EXPECT_NE(status.ToString().find("Irregular broadcast"), std::string::npos);
432429
}
433430

434431
shape = Tensor{DT_INT32, {static_cast<int64_t>(shape_vector.size())}};
@@ -438,17 +435,16 @@ TEST_F(RangeCoderOpsTest, InvalidBroadcast) {
438435
{
439436
const Status status = RunDecodeOp(10, {empty, shape, cdf}, &unused);
440437
EXPECT_FALSE(status.ok());
441-
EXPECT_NE(status.error_message().find("Irregular broadcast"),
442-
std::string::npos);
438+
EXPECT_NE(status.ToString().find("Irregular broadcast"), std::string::npos);
443439
}
444440
}
445441

446-
#define EXPECT_STATUS_SUBSTR(status_expr, message) \
447-
{ \
448-
auto status = (status_expr); \
449-
EXPECT_FALSE(status.ok()); \
450-
EXPECT_NE(status.error_message().find((message)), std::string::npos) \
451-
<< status.error_message(); \
442+
#define EXPECT_STATUS_SUBSTR(status_expr, message) \
443+
{ \
444+
auto status = (status_expr); \
445+
EXPECT_FALSE(status.ok()); \
446+
EXPECT_NE(status.ToString().find((message)), std::string::npos) \
447+
<< status.ToString(); \
452448
}
453449

454450
TEST_F(RangeCoderOpsTest, EncoderDebug) {

tensorflow_compression/cc/kernels/unbounded_index_range_coding_kernels_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ TEST_F(UnboundedIndexRangeCoderOpsTest, EncoderDebug) {
312312
auto status = \
313313
RunEncodeOpDebug(5, 2, {data, index, cdf, cdf_size, offset}); \
314314
EXPECT_FALSE(status.ok()); \
315-
EXPECT_NE(status.error_message().find((message)), string::npos) \
316-
<< status.error_message(); \
315+
EXPECT_NE(status.ToString().find((message)), string::npos) \
316+
<< status.ToString(); \
317317
}
318318

319319
index.scalar<int32_t>()() = -1;

0 commit comments

Comments
 (0)