-
Notifications
You must be signed in to change notification settings - Fork 458
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
Python unit test module LookTest update #1027
Python unit test module LookTest update #1027
Conversation
Signed-off-by: Mei Chu <[email protected]>
If it's crashing that's a bug. I'll take a look at the bindings. |
Found the cause of the segfault. For certain argument types, pybind11 will convert I've tested this in for Look and BuiltinTransform (which had the same issue in my tests), and it fixes it. Following the fix, these calls raise a Change FROM:
TO (note the 3 added
|
Signed-off-by: Mei Chu <[email protected]>
Signed-off-by: Mei Chu <[email protected]>
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.
Looks good Mei! I made some very minor suggestions for clarity. Otherwsie LGTM.
Signed-off-by: Mei Chu <[email protected]>
Just a quick follow up question. If I were to Would it more clear to list all parameters in its default order for ease of constructor readability? |
The |
It looks like Look.cpp operator<< is unchanged from v1. As is the case with many of the op<<, some members are not printed if they have empty/default values. Important members (name and process space in this case) are printed, however, even if empty. The names seem to be sorted based on importance rather than alphabetically. Doesn't the order already match the python constructor? What order do you think would be better? I'm noticing that we added a description member to Look but we did not update the op<< to print it, so that is a minor bug to be fixed. |
Per discussion today in the meeting, I can understand that the string representation of Look() object is just showing the more important bits. Just to elaborate more on what I was referring to earlier:
By default, it pretty much has nothing. So now I purposely pass in a wrong type parameter so that I know exactly what Look() object parameters there are. I was only wondering if there is a more elegant way to display what parameters are available in this object otherwise (besides using
I put in a description parameter and it doesn't get displayed. But ultimately, I get the desire to only show the more important stuff per today's meeting discussion! |
@@ -34,11 +34,11 @@ | |||
import BuiltinTransformRegistryTest | |||
import BuiltinTransformTest | |||
import CDLTransformTest | |||
import LookTest |
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 could be nice to sort these in alphabetical order
@@ -59,12 +59,12 @@ def suite(): | |||
suite.addTest(loader.loadTestsFromModule(BuiltinTransformRegistryTest)) | |||
suite.addTest(loader.loadTestsFromModule(BuiltinTransformTest)) | |||
suite.addTest(loader.loadTestsFromModule(CDLTransformTest)) | |||
suite.addTest(loader.loadTestsFromModule(LookTest)) |
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.
alphabetical order?
@meimchu, I think you raise a good point that it would be nice for python users to easily see what are the available members to set. But at the same time, we want to keep the printed values compact and not print seldom used members that are at their default value. Perhaps the best solution is for the doc string to list the available members and what they do? |
Signed-off-by: Mei Chu <[email protected]>
* Initial update to python unit test module LookTest. Signed-off-by: Mei Chu <[email protected]> * Updated PyLook and added some extra wrong type tests for LookTest.py Signed-off-by: Mei Chu <[email protected]> * Updated LookTest and PyLook according to feedbacks. Signed-off-by: Mei Chu <[email protected]> * Updated python LookTest according to further feedbacks. Signed-off-by: Mei Chu <[email protected]> * Updated constructor method names per feedback. Signed-off-by: Mei Chu <[email protected]> Co-authored-by: Patrick Hodoul <[email protected]>
* Initial update to python unit test module LookTest. Signed-off-by: Mei Chu <[email protected]> * Updated PyLook and added some extra wrong type tests for LookTest.py Signed-off-by: Mei Chu <[email protected]> * Updated LookTest and PyLook according to feedbacks. Signed-off-by: Mei Chu <[email protected]> * Updated python LookTest according to further feedbacks. Signed-off-by: Mei Chu <[email protected]> * Updated constructor method names per feedback. Signed-off-by: Mei Chu <[email protected]> Co-authored-by: Patrick Hodoul <[email protected]>
* Initial update to python unit test module LookTest. Signed-off-by: Mei Chu <[email protected]> * Updated PyLook and added some extra wrong type tests for LookTest.py Signed-off-by: Mei Chu <[email protected]> * Updated LookTest and PyLook according to feedbacks. Signed-off-by: Mei Chu <[email protected]> * Updated python LookTest according to further feedbacks. Signed-off-by: Mei Chu <[email protected]> * Updated constructor method names per feedback. Signed-off-by: Mei Chu <[email protected]> Co-authored-by: Patrick Hodoul <[email protected]>
Result of the LookTest module update:
test_constructor_with_keyword (LookTest.LookTest) ... ok test_constructor_without_keyword (LookTest.LookTest) ... ok test_constructor_without_parameter (LookTest.LookTest) ... ok test_constructor_wrong_parameter_type (LookTest.LookTest) ... ok test_description (LookTest.LookTest) ... Segmentation fault: 11
The wrong type tests in
setName()
,setProcessSpace()
, andsetDescription()
will trigger a segmentation fault. That seems like a really harsh rejection and perhaps it would be nice to have it throw exceptions instead of a crash? The rest of the test are fine and should pass without issues.