Patchwork [5,of,6] py3: convert print to a function call in a few tests

login
register
mail settings
Submitter Matt Harbison
Date Sept. 30, 2018, 5:46 a.m.
Message ID <a690c4f6b7a38a09346d.1538286384@Envy>
Download mbox | patch
Permalink /patch/35216/
State Accepted
Headers show

Comments

Matt Harbison - Sept. 30, 2018, 5:46 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1538284241 14400
#      Sun Sep 30 01:10:41 2018 -0400
# Node ID a690c4f6b7a38a09346dcf51691fd2ccddefaa12
# Parent  e2b23a432bcf799a5126a558d6b10a4c96929a2a
py3: convert print to a function call in a few tests

I *think* this is the last of them.
Yuya Nishihara - Sept. 30, 2018, 12:08 p.m.
On Sun, 30 Sep 2018 01:46:24 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1538284241 14400
> #      Sun Sep 30 01:10:41 2018 -0400
> # Node ID a690c4f6b7a38a09346dcf51691fd2ccddefaa12
> # Parent  e2b23a432bcf799a5126a558d6b10a4c96929a2a
> py3: convert print to a function call in a few tests

> -  > print u'''
> +  > print(u'''
>    > echo a > text
>    > hg add text
>    > hg --encoding utf-8 commit -u '\u30A2' -m none
> @@ -1538,13 +1538,13 @@ test author/desc/keyword in problematic 
>    > hg --encoding utf-8 commit -u none -m '\u30A2'
>    > echo d > text
>    > hg --encoding utf-8 commit -u none -m '\u30C2'
> -  > '''.encode('utf-8')
> +  > ''').encode('utf-8')

Maybe .encode() should be inside the paren.
Matt Harbison - Sept. 30, 2018, 1:24 p.m.
> On Sep 30, 2018, at 8:08 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> 
>> On Sun, 30 Sep 2018 01:46:24 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbison@yahoo.com>
>> # Date 1538284241 14400
>> #      Sun Sep 30 01:10:41 2018 -0400
>> # Node ID a690c4f6b7a38a09346dcf51691fd2ccddefaa12
>> # Parent  e2b23a432bcf799a5126a558d6b10a4c96929a2a
>> py3: convert print to a function call in a few tests
> 
>> -  > print u'''
>> +  > print(u'''
>>> echo a > text
>>> hg add text
>>> hg --encoding utf-8 commit -u '\u30A2' -m none
>> @@ -1538,13 +1538,13 @@ test author/desc/keyword in problematic 
>>> hg --encoding utf-8 commit -u none -m '\u30A2'
>>> echo d > text
>>> hg --encoding utf-8 commit -u none -m '\u30C2'
>> -  > '''.encode('utf-8')
>> +  > ''').encode('utf-8')
> 
> Maybe .encode() should be inside the paren.

Yeah, that makes more sense.  Odd that the test ran fine in both py2 and py3.  Can you amend that?
Yuya Nishihara - Sept. 30, 2018, 1:42 p.m.
On Sun, 30 Sep 2018 09:24:36 -0400, Matt Harbison wrote:
> 
> > On Sep 30, 2018, at 8:08 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> > 
> >> On Sun, 30 Sep 2018 01:46:24 -0400, Matt Harbison wrote:
> >> # HG changeset patch
> >> # User Matt Harbison <matt_harbison@yahoo.com>
> >> # Date 1538284241 14400
> >> #      Sun Sep 30 01:10:41 2018 -0400
> >> # Node ID a690c4f6b7a38a09346dcf51691fd2ccddefaa12
> >> # Parent  e2b23a432bcf799a5126a558d6b10a4c96929a2a
> >> py3: convert print to a function call in a few tests
> > 
> >> -  > print u'''
> >> +  > print(u'''
> >>> echo a > text
> >>> hg add text
> >>> hg --encoding utf-8 commit -u '\u30A2' -m none
> >> @@ -1538,13 +1538,13 @@ test author/desc/keyword in problematic 
> >>> hg --encoding utf-8 commit -u none -m '\u30A2'
> >>> echo d > text
> >>> hg --encoding utf-8 commit -u none -m '\u30C2'
> >> -  > '''.encode('utf-8')
> >> +  > ''').encode('utf-8')
> > 
> > Maybe .encode() should be inside the paren.
> 
> Yeah, that makes more sense.  Odd that the test ran fine in both py2 and py3.  Can you amend that?

Done.

Patch

diff --git a/tests/test-notify.t b/tests/test-notify.t
--- a/tests/test-notify.t
+++ b/tests/test-notify.t
@@ -412,7 +412,7 @@  non-ascii content and truncation of mult
   > EOF
   $ echo a >> a/a
   $ hg --cwd a --encoding utf-8 commit -A -d '0 0' \
-  >   -m `"$PYTHON" -c 'print "\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4"'`
+  >   -m `"$PYTHON" -c 'print("\xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4")'`
   $ hg --traceback --cwd b --encoding utf-8 pull ../a | \
   >   "$PYTHON" $TESTTMP/filter.py
   pulling from ../a
diff --git a/tests/test-revset2.t b/tests/test-revset2.t
--- a/tests/test-revset2.t
+++ b/tests/test-revset2.t
@@ -413,14 +413,14 @@  no crash by empty group "()" while optim
 test that chained `or` operations never eat up stack (issue4624)
 (uses `0:1` instead of `0` to avoid future optimization of trivial revisions)
 
-  $ hg log -T '{rev}\n' -r `"$PYTHON" -c "print '+'.join(['0:1'] * 500)"`
+  $ hg log -T '{rev}\n' -r `"$PYTHON" -c "print('+'.join(['0:1'] * 500))"`
   0
   1
 
 test that repeated `-r` options never eat up stack (issue4565)
 (uses `-r 0::1` to avoid possible optimization at old-style parser)
 
-  $ hg log -T '{rev}\n' `"$PYTHON" -c "for i in range(500): print '-r 0::1 ',"`
+  $ hg log -T '{rev}\n' `"$PYTHON" -c "for i in range(500): print('-r 0::1 ')"`
   0
   1
 
@@ -1528,7 +1528,7 @@  test author/desc/keyword in problematic 
   $ cd problematicencoding
 
   $ "$PYTHON" > setup.sh <<EOF
-  > print u'''
+  > print(u'''
   > echo a > text
   > hg add text
   > hg --encoding utf-8 commit -u '\u30A2' -m none
@@ -1538,13 +1538,13 @@  test author/desc/keyword in problematic 
   > hg --encoding utf-8 commit -u none -m '\u30A2'
   > echo d > text
   > hg --encoding utf-8 commit -u none -m '\u30C2'
-  > '''.encode('utf-8')
+  > ''').encode('utf-8')
   > EOF
   $ sh < setup.sh
 
 test in problematic encoding
   $ "$PYTHON" > test.sh <<EOF
-  > print u'''
+  > print(u'''
   > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)'
   > echo ====
   > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)'
@@ -1556,7 +1556,7 @@  test in problematic encoding
   > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)'
   > echo ====
   > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)'
-  > '''.encode('cp932')
+  > ''').encode('cp932')
   > EOF
   $ sh < test.sh
   0