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

Unit tests when using the regex module instead of re fails #24

Closed
crogre opened this issue Oct 19, 2012 · 2 comments
Closed

Unit tests when using the regex module instead of re fails #24

crogre opened this issue Oct 19, 2012 · 2 comments

Comments

@crogre
Copy link

crogre commented Oct 19, 2012

I tried replacing "import re" with "import regex as re" in lex.py and yacc.py for good measure (I saw that regex is slotted for python 3.4 and that that module supports concurrency) but got two errors in the lex unit tests (python testlex.py):

FAIL: test_lex_re1 (main.LexErrorWarningTests)

Traceback (most recent call last):
File "testlex.py", line 143, in test_lex_re1
"Invalid regular expression for rule 't_NUMBER'. unbalanced parenthesis\n"))
AssertionError: False is not true

FAIL: test_lex_re3 (main.LexErrorWarningTests)

Traceback (most recent call last):
File "testlex.py", line 155, in test_lex_re3
"Invalid regular expression for rule 't_POUND'. unbalanced parenthesis\n"
AssertionError: False is not true

According to the maintainer of regex this is because the exception messages are different - regex throws "missing )" instead of "unbalanced parenthesis".

Is it correct to rely on the message strings for the unit tests?

@dabeaz
Copy link
Owner

dabeaz commented May 29, 2013

Unit tests are checking for specific errors. Will revisit in future. Leaving issue open for now.

@dabeaz
Copy link
Owner

dabeaz commented Apr 16, 2015

As far as I know, the status of "regex" in the standard library is pretty unclear at this point. Going to close the issue for now, but will revisit should its status change.

@dabeaz dabeaz closed this as completed Apr 16, 2015
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

No branches or pull requests

2 participants