Skip to content

New pattern matching keywords in Collections - #1756

Merged
pekkaklarck merged 1 commit into
robotframework:masterfrom
guykisel:pattern_matching_new_kws
Jul 31, 2014
Merged

pekkaklarck merged 1 commit into
robotframework:masterfrom
guykisel:pattern_matching_new_kws

Conversation

@guykisel

Copy link
Copy Markdown
Contributor

This replaces pull request #1751. This is for issue #1724.

Comment thread src/robot/utils/match.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. Is self.flags really needed? Why not to pass flags to _get_and_compile_regexp?

  2. 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.

@guykisel

Copy link
Copy Markdown
Contributor Author

Still need to write more test cases to cover the new keywords and new functionality. Not ready for merge.

@guykisel

Copy link
Copy Markdown
Contributor Author

@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.

@pekkaklarck

Copy link
Copy Markdown
Member

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.

@guykisel

Copy link
Copy Markdown
Contributor Author

@pekkaklarck I think this pull request is done (besides a squash). What do you think?

Comment thread AUTHORS.txt Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a bit vague considering that we decided to just add new matching related keywords to Collections.

@pekkaklarck

Copy link
Copy Markdown
Member

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.

@guykisel

Copy link
Copy Markdown
Contributor Author

Squashed.

@guykisel guykisel changed the title Case insensitive and pattern matching New pattern matching keywords in Collections Jul 31, 2014
pekkaklarck added a commit that referenced this pull request Jul 31, 2014
New pattern matching keywords in Collections
@pekkaklarck
pekkaklarck merged commit b66b90e into robotframework:master Jul 31, 2014
@pekkaklarck

Copy link
Copy Markdown
Member

Thanks @guykisel for your work!

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.

2 participants