From 31115b4387ade7157257edc1714693bb8da05ba0 Mon Sep 17 00:00:00 2001 From: Parth Chadha Date: Fri, 2 Aug 2024 10:57:33 -0700 Subject: [PATCH] Fix the error string in matched in testing to match what is generated by the backend --- tripy/docs/post0_developer_guides/how-to-add-new-ops.md | 2 +- tripy/tests/backend/mlir/test_compiler.py | 2 +- tripy/tests/frontend/test_shape.py | 5 +---- tripy/tests/frontend/trace/ops/test_reshape.py | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/tripy/docs/post0_developer_guides/how-to-add-new-ops.md b/tripy/docs/post0_developer_guides/how-to-add-new-ops.md index 7a980f438..d70f8a77e 100644 --- a/tripy/docs/post0_developer_guides/how-to-add-new-ops.md +++ b/tripy/docs/post0_developer_guides/how-to-add-new-ops.md @@ -390,7 +390,7 @@ class TestTheta: # which ensures that we emit an error if the `dim` parameter is outside # the allowed range. def test_invalid_dim(self): - with helper.raises(tp.TripyException, match="iota dimension cannot go beyond the output rank or be negative."): + with helper.raises(tp.TripyException, match="iota dimension cannot go beyond the output rank"): tp.theta([2, 3], dim=3).eval() ``` diff --git a/tripy/tests/backend/mlir/test_compiler.py b/tripy/tests/backend/mlir/test_compiler.py index 7036a4f71..f4177a48f 100644 --- a/tripy/tests/backend/mlir/test_compiler.py +++ b/tripy/tests/backend/mlir/test_compiler.py @@ -39,7 +39,7 @@ def test_reshape_invalid_volume(self): with helper.raises( tp.TripyException, - r"output_shape is incompatible with input type of operation: input has 4 elements, but output_shape has 9", + r"number of output elements \(9\) doesn't match expected number of elements \(4\)", has_stack_info_for=[tensor, reshaped], ): reshaped.eval() diff --git a/tripy/tests/frontend/test_shape.py b/tripy/tests/frontend/test_shape.py index a4b2686e1..7b91d9d36 100644 --- a/tripy/tests/frontend/test_shape.py +++ b/tripy/tests/frontend/test_shape.py @@ -344,10 +344,7 @@ def test_unary_elementwise_fails_at_run_time(self, values): with raises( tp.TripyException, match=( - "must be ranked tensor of f8E4M3B11FNUZ type or f8E4M3FN type or f8E4M3FNUZ type " - "or f8E5M2 type or f8E5M2FNUZ type or 16-bit float or 32-bit float or 64-bit float or bfloat16 " - "type or complex type with 32-bit float or 64-bit float elements or 4/8/16/32-bit uniform " - "quantized signed integer or 4/8/16/32-bit uniform quantized unsigned integer values" + "'stablehlo.exponential' op operand #0 must be ranked tensor of" ), ): v.eval() diff --git a/tripy/tests/frontend/trace/ops/test_reshape.py b/tripy/tests/frontend/trace/ops/test_reshape.py index 1c110deba..9d46bc6c8 100644 --- a/tripy/tests/frontend/trace/ops/test_reshape.py +++ b/tripy/tests/frontend/trace/ops/test_reshape.py @@ -55,7 +55,7 @@ def test_incorrect_dims(self): with helper.raises( tp.TripyException, - match="output_shape is incompatible with input type of operation: input has 4 elements, but output_shape has 1", + match="number of output elements \(1\) doesn't match expected number of elements \(4\)", has_stack_info_for=[a, b], ): b.eval()