[PATCH 2 of 2] run-tests: assign value to ESCAPEMAP - dict.update do not return self

Mads Kiilerich mads at kiilerich.com
Sun May 25 06:55:32 CDT 2014


On 05/25/2014 01:48 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski at unity3d.com>
> # Date 1401018462 -7200
> #      Sun May 25 13:47:42 2014 +0200
> # Node ID 665481b33700b726fb48fd7bc930239499f2ac65
> # Parent  c5e55adeb37b9e1bcaec2e9fc3745f47d568e3d1
> run-tests: assign value to ESCAPEMAP - dict.update do not return self
>
> a36cc85a5b7b did more than what the description said and introduced a bug.
>
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -675,8 +675,8 @@ class TTest(Test):
>       NEEDESCAPE = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search
>   
>       ESCAPESUB = re.compile(r'[\x00-\x08\x0b-\x1f\\\x7f-\xff]').sub

related to a36cc85a5b7b: I think the convention of using upper case for 
"global" simple "static consts" is fine ... and it might also extend to 
static class members. But these two are just functions (that happens to 
be defined in a clever/ugly way). I do not think the upper case 
convention should apply to them.

/Mads

> -    ESCAPEMAP = dict((chr(i), r'\x%02x' % i) for i in range(256)).update(
> -                     {'\\': '\\\\', '\r': r'\r'})
> +    ESCAPEMAP = dict((chr(i), r'\x%02x' % i) for i in range(256))
> +    ESCAPEMAP.update({'\\': '\\\\', '\r': r'\r'})
>   
>       @property
>       def refpath(self):



More information about the Mercurial-devel mailing list