Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Improve check for TVMError exception in test_cast #15138

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

kparzysz-quic
Copy link
Contributor

The original code has

with pytest.raises(tvm.error.TVMError):
    s.astype("int")
    assert "Can't cast a handle to other types" in str(e)

The astype is expected to throw a TVMError exception, but if it does, the following assertion never gets executed.

Add try/except to the test to verify that the expected exception is thrown.

The original code has
```
with pytest.raises(tvm.error.TVMError):
    s.astype("int")
    assert "Can't cast a handle to other types" in str(e)
```
The `astype` is expected to throw a TVMError exception, but if it does,
the following assertion never gets executed.

Add try/except to the test to verify that the expected exception is
thrown.
@tvm-bot
Copy link
Collaborator

tvm-bot commented Jun 21, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to tag found in teams: test See #10317 for details

Generated by tvm-bot

Copy link
Contributor

@echuraev echuraev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@echuraev echuraev merged commit 2c48d7b into apache:main Jun 22, 2023
@kparzysz-quic kparzysz-quic deleted the better-exception-test branch June 22, 2023 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants