Patchwork [STABLE] tests: make doctest py3-compatible again

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 27, 2018, 9:33 a.m.
Message ID <55581bca2fc76863fed1.1517045595@mimosa>
Download mbox | patch
Permalink /patch/27072/
State Superseded
Headers show

Comments

Yuya Nishihara - Jan. 27, 2018, 9:33 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1517030246 -32400
#      Sat Jan 27 14:17:26 2018 +0900
# Branch stable
# Node ID 55581bca2fc76863fed118841ffbb068502f4b83
# Parent  b91bca85ba73c5a755a9e4ae44aaeb787ee3fae2
tests: make doctest py3-compatible again

A parsed tree is replaced with parse(expr) because it sucks to add b'' to
every string literal.

Patch

diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -635,7 +635,7 @@  def formatspec(expr, *args):
     "root(_list('a\\\\x00b\\\\x00c\\\\x00d'))"
     >>> formatspec(b'sort(%r, %ps)', b':', [b'desc', b'user'])
     "sort((:), 'desc', 'user')"
-    >>> formatspec('%ls', ['a', "'"])
+    >>> formatspec(b'%ls', [b'a', b"'"])
     "_list('a\\\\x00\\\\'')"
     '''
     expr = pycompat.bytestr(expr)
@@ -717,13 +717,13 @@  def _ishashlikesymbol(symbol):
 def gethashlikesymbols(tree):
     """returns the list of symbols of the tree that look like hashes
 
-    >>> gethashlikesymbols(('dagrange', ('symbol', '3'), ('symbol', 'abe3ff')))
+    >>> gethashlikesymbols(parse(b'3::abe3ff'))
     ['3', 'abe3ff']
-    >>> gethashlikesymbols(('func', ('symbol', 'precursors'), ('symbol', '.')))
+    >>> gethashlikesymbols(parse(b'precursors(.)'))
     []
-    >>> gethashlikesymbols(('func', ('symbol', 'precursors'), ('symbol', '34')))
+    >>> gethashlikesymbols(parse(b'precursors(34)'))
     ['34']
-    >>> gethashlikesymbols(('symbol', 'abe3ffZ'))
+    >>> gethashlikesymbols(parse(b'abe3ffZ'))
     []
     """
     if not tree: