[sgf-parsing] fix escaped characters test
See original GitHub issueRunning the tests for sgf-parsing
throws a DeprecationWarning related to an invalid escape sequence. This is due to the \]
inclusions in the test string, which really should be \\]
to work correctly.
Now from the canonical data we are getting '(;A[\\]b\\nc\\nd\\t\\te \\n\\]])'
, but by the time it’s rendered into the _test.py it’s become "(;A[\]b\nc\nd\t\te \n\]])"
, leading to the aforementioned warning.
To fix this we’d seemingly need to flag the literal as raw before parsing the json file, or we’d need to manually correct for improperly escaped non-control characters.
Unfortunately we cannot just render the strings with “r” in front of them in the Jinja template, as that ends up turning \n
into two characters, \\
and n
.
Open to ideas.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
SabakiHQ/sgf: A library for parsing SGF files. - GitHub
Resolves escaped characters and returns the new string. sgf.parseVertex(input). input <String>. Turns an SGF point ...
Read more >Process escape sequences in a string in Python
The correct thing to do is use the 'string-escape' code to decode the string. ... But if there are any literal non-ASCII characters...
Read more >SGF Parsing in Python on Exercism
Can you solve SGF Parsing in Python? ... Parsing a Smart Game Format string. ... Note that SGF does not have escape sequences...
Read more >Jelly escaping types - ServiceNow Docs
You use different methods when escaping characters in JavaScript and HTML. ... Test a fix script · Run fix scripts ... XML parser...
Read more >Preventing Escape Sequence Interpretation in Python
After the encounter of a backslash (inside a string), any following character (with the ( \ )) would be looked upon the aforementioned...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No worries, I just wanted to have both our thoughts down in case I’m wrong and we need to revisit in the future.
The above suggestion works on my machine. If that’s an acceptable solution, I’ll PR it.