Skip to content

Commit

Permalink
Fix the error string in matched in testing to match what is generated…
Browse files Browse the repository at this point in the history
… by the backend
  • Loading branch information
parthchadha committed Aug 2, 2024
1 parent aaccbe6 commit 31115b4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tripy/docs/post0_developer_guides/how-to-add-new-ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
```

Expand Down
2 changes: 1 addition & 1 deletion tripy/tests/backend/mlir/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 1 addition & 4 deletions tripy/tests/frontend/test_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tripy/tests/frontend/trace/ops/test_reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 31115b4

Please sign in to comment.