[Updated] D9349: tests: make doctests not depend on str(ParseError()) format
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Sat Nov 21 02:51:54 UTC 2020
Closed by commit rHG18489e26d9a0: tests: make doctests not depend on str(ParseError()) format (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9349?vs=23586&id=23600
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9349/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9349
AFFECTED FILES
mercurial/revsetlang.py
mercurial/templater.py
CHANGE DETAILS
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -376,14 +376,22 @@
('string', 'foo')
>>> parseexpr(b'foo(bar)')
('func', ('symbol', 'foo'), ('symbol', 'bar'))
- >>> parseexpr(b'foo(')
- Traceback (most recent call last):
- ...
- ParseError: ('not a prefix: end', 4)
- >>> parseexpr(b'"foo" "bar"')
- Traceback (most recent call last):
- ...
- ParseError: ('invalid token', 7)
+ >>> from . import error
+ >>> from . import pycompat
+ >>> try:
+ ... parseexpr(b'foo(')
+ ... except error.ParseError as e:
+ ... pycompat.sysstr(e.message)
+ ... e.location
+ 'not a prefix: end'
+ 4
+ >>> try:
+ ... parseexpr(b'"foo" "bar"')
+ ... except error.ParseError as e:
+ ... pycompat.sysstr(e.message)
+ ... e.location
+ 'invalid token'
+ 7
"""
try:
return _parseexpr(expr)
diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -558,14 +558,22 @@
>>> _parsewith(b'foo($1)', syminitletters=_aliassyminitletters)
('func', ('symbol', 'foo'), ('symbol', '$1'))
- >>> _parsewith(b'$1')
- Traceback (most recent call last):
- ...
- ParseError: ("syntax error in revset '$1'", 0)
- >>> _parsewith(b'foo bar')
- Traceback (most recent call last):
- ...
- ParseError: ('invalid token', 4)
+ >>> from . import error
+ >>> from . import pycompat
+ >>> try:
+ ... _parsewith(b'$1')
+ ... except error.ParseError as e:
+ ... pycompat.sysstr(e.message)
+ ... e.location
+ "syntax error in revset '$1'"
+ 0
+ >>> try:
+ ... _parsewith(b'foo bar')
+ ... except error.ParseError as e:
+ ... pycompat.sysstr(e.message)
+ ... e.location
+ 'invalid token'
+ 4
"""
if lookup and spec.startswith(b'revset(') and spec.endswith(b')'):
lookup = None
To: martinvonz, #hg-reviewers, mharbison72
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201121/5a6dc9f5/attachment-0002.html>
More information about the Mercurial-patches
mailing list