-
Notifications
You must be signed in to change notification settings - Fork 615
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
Adjust usage of rasies and assert_raises in tests #3318
Conversation
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
!build |
CI MESSAGE: [2924536]: BUILD STARTED |
CI MESSAGE: [2924536]: BUILD FAILED |
CI MESSAGE: [2924536]: BUILD PASSED |
@@ -29,7 +29,7 @@ def test_keras_single_cpu(): | |||
run_keras_single_device('cpu', 0) | |||
|
|||
|
|||
@raises(Exception) | |||
@raises(Exception, "TF device and DALI device mismatch. TF*: CPU, DALI*: GPU for output*") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to add trailing *
at the end of glob pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
batch_size=batch_size, | ||
output_shapes=shapes, | ||
output_dtypes=dtypes, | ||
num_threads=num_threads) | ||
|
||
|
||
@raises(RuntimeError) | ||
@raises(RuntimeError, "*some operators*cannot be used with TensorFlow Dataset API and DALIIterator") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need leading *
in glob pattern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really.
|
||
for shape, layout in [([6, 1], "XF"), ([8, 10, 3], "HWC")]: | ||
with assert_raises(RuntimeError, | ||
glob="Input layout must describe a sequence*start with 'F', got*instead"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not about this pattern. wildcards inside doesn't provide any flexibility from my point of view, so you can put the whole message here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
check_element_extract(shape, layout, [1, 3], "cpu") | ||
|
||
with assert_raises(RuntimeError, | ||
glob="Index*10*from *element_map* out of bounds for*sequence length*6*"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not about this pattern. wildcards inside doesn't provide any flexibility from my point of view, so you can put the whole message here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I'm just worried, that we will want to fix the '
, ` and "
around the variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then we can adjust the test, it would be easily detectable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unclear for me what we want to leave undefined and what to be strict about. *
just for "
or ` blurs the pattern from my point of view.
!build |
CI MESSAGE: [2931550]: BUILD STARTED |
CI MESSAGE: [2931550]: BUILD PASSED |
Description
What happened in this PR
assert_raises
andraises
utilities with glob pattern checked against
the error message.
(cause the expected exception).
Additional information
Affected modules and functionalities:
tests
Key points relevant for the review:
N/A
Checklist
Tests
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: DALI-2234