diff --git a/cpp/src/arrow/json/reader_test.cc b/cpp/src/arrow/json/reader_test.cc index bc533595614..9d056388a01 100644 --- a/cpp/src/arrow/json/reader_test.cc +++ b/cpp/src/arrow/json/reader_test.cc @@ -741,9 +741,13 @@ TEST_P(StreamingReaderTest, PropagateErrorsNonLinewiseChunker) { read_options_.block_size = 10; parse_options_.newlines_in_values = true; - EXPECT_RAISES_WITH_MESSAGE_THAT(Invalid, - ::testing::StartsWith("Invalid: JSON parse error"), - MakeReader(bad_first_block)); + // (can't use ::testing::MatchesRegex because of + // https://github.com/google/googletest/issues/3084) + EXPECT_RAISES_WITH_MESSAGE_THAT( + Invalid, + ::testing::AnyOf(::testing::StartsWith("Invalid: JSON parse error"), + ::testing::StartsWith("Invalid: Failed to get JSON object")), + MakeReader(bad_first_block)); ASSERT_OK_AND_ASSIGN(reader, MakeReader(bad_middle_blocks)); AssertReadNext(reader, &batch); diff --git a/python/pyarrow/tests/test_json.py b/python/pyarrow/tests/test_json.py index 2239c2f1bb8..3dc54d53fba 100644 --- a/python/pyarrow/tests/test_json.py +++ b/python/pyarrow/tests/test_json.py @@ -525,7 +525,7 @@ def test_non_linewise_chunker_first_block(self): 'n': [0] } with pytest.raises(pa.ArrowInvalid, - match="JSON parse error *"): + match="(JSON parse error|Failed to get JSON object)"): reader.read_next_batch() with pytest.raises(StopIteration): @@ -546,7 +546,7 @@ def test_non_linewise_chunker_bad_first_block(self): 'n': [0] } with pytest.raises(pa.ArrowInvalid, - match="JSON parse error *"): + match="(JSON parse error|Failed to get JSON object)"): reader.read_next_batch() with pytest.raises(StopIteration):