Repository navigation
New pattern matching keywords in Collections - #1756
Conversation
There was a problem hiding this comment.
-
Is self.flags really needed? Why not to pass flags to _get_and_compile_regexp?
-
Is re.IGNORECASE needed? Aren't both pattern and matched string normalized anyway? If it's not needed, there's no need to pass flags at all, re.compile can just use re.DOTALL.
|
Still need to write more test cases to cover the new keywords and new functionality. Not ready for merge. |
|
@pekkaklarck I added a ValueError for non-strings as you suggested, but the stdlib docs suggest using a TypeError for this situation - https://docs.python.org/2/library/exceptions.html#exceptions.TypeError Is raising a ValueError for an unexpected type the convention in Robot Framework? If so, I will raise a ValueError. Otherwise, I think it might be more pythonic to raise a TypeError. |
|
Right, TypeError is definitely better in this case. Robot Framework doesn't differentiate between ValueErrors and TypeErrors. Only related logic is that it drops the exception name from error messages with generic exceptions such as AssertionError, RuntimeError, and Exception. It's possible to drop that name also by using ROBOT_SUPPRESS_NAME attribute, but I don't think that's a good idea here. Having TypeError in the message is just fine. |
|
@pekkaklarck I think this pull request is done (besides a squash). What do you think? |
There was a problem hiding this comment.
This is a bit vague considering that we decided to just add new matching related keywords to Collections.
|
Yeah, changes look great. Sorry for ignoring this due to holidays. I added some minor comments mainly related to docs. Would be great if you could take a look do you agree with them and fix the ones you consider worth fixing. That plus squashing and I'll merge the pull request. |
|
Squashed. |
New pattern matching keywords in Collections
|
Thanks @guykisel for your work! |
This replaces pull request #1751. This is for issue #1724.