You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TST: testing not catching bad escape sequences in doc strings #11335
""" Initialize the artist inspector with an `Artist` or an iterable of `Artist`\s. If an iterable is used, we assume it is a homogeneous sequence (all `Artists` are of the same type) and it is your responsibility to make sure this is so. """
Cause SyntaxError: invalid escape sequence \s on my machine. Somehow they aren't crashing the test suite?
It is possible to mark up individual characters within a word with backslash escapes (see Escaping Mechanism above). Backslash escapes can be used to allow arbitrary text to immediately follow inline markup: Python ``list``\s use square bracket syntax.
The backslash will disappear from the processed document. The word "list" will appear as inline literal text, and the letter "s" will immediately follow it as normal text, with no space in-between.
Yes, #11336 fixes the problem on my at-home machine (I didn't test your PR, but thats what I did to get the tests to run).
OTOH, it doesn't a) explain why the two machines are different despite having the same operating system and python/matplotlib installed the same way, or b) how we can make sure future docstrings that have backslashes get an r in front of them...
Re-opening as #11336 fixed the cause not the symptom 😉. I think we want to have a test that makes sure PEP-0257 is followed wrt escaped docstrings. Again, not sure what the difference is between my machines, but I can't imagine I'll be the only person burned by this in the future...
Did it? We still don't use tests.py, so things are not checked. I fixed several new ones in #11477. We can install the flake8-invalid-escape-sequences plugin, or wait until the next minor release of flake8 which will use pycodestyle 2.4.0, that supports this builtin.
Activity
jklymak commentedon May 29, 2018
I only have this problem on my at-home machine. So maybe a setup issue. At work, which I thought was basically the same install, things work fine....
timhoffm commentedon May 29, 2018
Please try if this fixes your issue.
ImportanceOfBeingErnest commentedon May 29, 2018
According to escaping-mechanism and character-level-inline-markup the backslash is a valid way to escape any character.
jklymak commentedon May 29, 2018
Yes, #11336 fixes the problem on my at-home machine (I didn't test your PR, but thats what I did to get the tests to run).
OTOH, it doesn't a) explain why the two machines are different despite having the same operating system and python/matplotlib installed the same way, or b) how we can make sure future docstrings that have backslashes get an
rin front of them...jklymak commentedon May 29, 2018
Re-opening as #11336 fixed the cause not the symptom 😉. I think we want to have a test that makes sure PEP-0257 is followed wrt escaped docstrings. Again, not sure what the difference is between my machines, but I can't imagine I'll be the only person burned by this in the future...
timhoffm commentedon May 29, 2018
Python 3.6 introduced this as a silent warning https://bugs.python.org/issue27364. Maybe you have different configurations for warnings? That would also be the path to note missing raw strings in our code base.
QuLogic commentedon May 29, 2018
tests.pyturns those warnings into errors, but we stopped using that on Travis a long time ago.tacaswell commentedon May 30, 2018
We should re-enable those warnings on travis (for both 2.2.x and master).
jklymak commentedon Jul 5, 2018
This got fixed....
QuLogic commentedon Jul 8, 2018
Did it? We still don't use
tests.py, so things are not checked. I fixed several new ones in #11477. We can install theflake8-invalid-escape-sequencesplugin, or wait until the next minor release offlake8which will usepycodestyle2.4.0, that supports this builtin.timhoffm commentedon Aug 26, 2019
Travis CI
flake8usespycodestyle2.5.0. So W605 "invalid escape sequence ‘x'" should be checked.