I'll just note that str() should normally be used rather than repr()
(or the prior `` marks). repr is one of those "yellow flag" items in
Python: before using it, ask yourself whether you really *need* to, or
if there is a better convention/idiom.
In all cases above, str() could have been better used, or even
"%sfoo%s" % (a, b) types of constructs.
Cheers,
-g
On Sun, Sep 28, 2008 at 4:48 PM, <arfrever_at_tigris.org> wrote:
> Author: arfrever
> Date: Sun Sep 28 16:48:00 2008
> New Revision: 33338
>
> Log:
> Python 3 compatibility:
> Use repr() instead of string conversions.
>
> * subversion/tests/cmdline/basic_tests.py:
> * subversion/tests/cmdline/diff_tests.py:
> * subversion/tests/cmdline/log_tests.py:
> * subversion/tests/cmdline/merge_tests.py:
> * subversion/tests/cmdline/svntest/actions.py:
> * subversion/tests/cmdline/svntest/main.py: Use repr() instead of string
> conversions.
>
> Modified:
> trunk/subversion/tests/cmdline/basic_tests.py
> trunk/subversion/tests/cmdline/diff_tests.py
> trunk/subversion/tests/cmdline/log_tests.py
> trunk/subversion/tests/cmdline/merge_tests.py
> trunk/subversion/tests/cmdline/svntest/actions.py
> trunk/subversion/tests/cmdline/svntest/main.py
>
> Modified: trunk/subversion/tests/cmdline/basic_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/basic_tests.py?pathrev=33338&r1=33337&r2=33338
> ==============================================================================
> --- trunk/subversion/tests/cmdline/basic_tests.py Sun Sep 28 16:32:18 2008 (r33337)
> +++ trunk/subversion/tests/cmdline/basic_tests.py Sun Sep 28 16:48:00 2008 (r33338)
> @@ -449,8 +449,8 @@ def basic_merging_update(sbox):
> mu_text = ""
> rho_text = ""
> for x in range(2,11):
> - mu_text = mu_text + '\nThis is line ' + `x` + ' in mu'
> - rho_text = rho_text + '\nThis is line ' + `x` + ' in rho'
> + mu_text = mu_text + '\nThis is line ' + repr(x) + ' in mu'
> + rho_text = rho_text + '\nThis is line ' + repr(x) + ' in rho'
> svntest.main.file_append(mu_path, mu_text)
> svntest.main.file_append(rho_path, rho_text)
>
> @@ -505,12 +505,12 @@ def basic_merging_update(sbox):
> # open in 'truncate to zero then write" mode
> backup_mu_text = 'This is the new line 1 in the backup copy of mu'
> for x in range(2,11):
> - backup_mu_text = backup_mu_text + '\nThis is line ' + `x` + ' in mu'
> + backup_mu_text = backup_mu_text + '\nThis is line ' + repr(x) + ' in mu'
> svntest.main.file_write(mu_path_backup, backup_mu_text, 'w+')
>
> backup_rho_text = 'This is the new line 1 in the backup copy of rho'
> for x in range(2,11):
> - backup_rho_text = backup_rho_text + '\nThis is line ' + `x` + ' in rho'
> + backup_rho_text = backup_rho_text + '\nThis is line ' + repr(x) + ' in rho'
> svntest.main.file_write(rho_path_backup, backup_rho_text, 'w+')
>
> # Create expected output tree for an update of the wc_backup.
>
> Modified: trunk/subversion/tests/cmdline/diff_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/diff_tests.py?pathrev=33338&r1=33337&r2=33338
> ==============================================================================
> --- trunk/subversion/tests/cmdline/diff_tests.py Sun Sep 28 16:32:18 2008 (r33337)
> +++ trunk/subversion/tests/cmdline/diff_tests.py Sun Sep 28 16:48:00 2008 (r33338)
> @@ -369,8 +369,8 @@ def repo_diff(wc_dir, rev1, rev2, check_
>
> exit_code, diff_output, err_output = svntest.main.run_svn(None,
> 'diff', '-r',
> - `rev2` + ':'
> - + `rev1`)
> + repr(rev2) + ':'
> + + repr(rev1))
> if check_fn(diff_output):
> raise svntest.Failure
>
>
> Modified: trunk/subversion/tests/cmdline/log_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/log_tests.py?pathrev=33338&r1=33337&r2=33338
> ==============================================================================
> --- trunk/subversion/tests/cmdline/log_tests.py Sun Sep 28 16:32:18 2008 (r33337)
> +++ trunk/subversion/tests/cmdline/log_tests.py Sun Sep 28 16:48:00 2008 (r33338)
> @@ -615,7 +615,7 @@ def check_log_chain(chain, revlist, path
> raise SVNUnexpectedLogs('Malformed log line counts', chain, 'lines')
>
> # Check that the log message looks right:
> - pattern = 'Log message for revision ' + `saw_rev`
> + pattern = 'Log message for revision ' + repr(saw_rev)
> msg_re = re.compile(pattern)
> if not msg_re.search(msg):
> raise SVNUnexpectedLogs("Malformed log message, expected '%s'" % msg,
>
> Modified: trunk/subversion/tests/cmdline/merge_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/merge_tests.py?pathrev=33338&r1=33337&r2=33338
> ==============================================================================
> --- trunk/subversion/tests/cmdline/merge_tests.py Sun Sep 28 16:32:18 2008 (r33337)
> +++ trunk/subversion/tests/cmdline/merge_tests.py Sun Sep 28 16:48:00 2008 (r33338)
> @@ -309,7 +309,7 @@ def textual_merges_galore(sbox):
> # clean.
> other_rho_text = ""
> for x in range(1,10):
> - other_rho_text = other_rho_text + 'Unobtrusive line ' + `x` + ' in rho\n'
> + other_rho_text = other_rho_text + 'Unobtrusive line ' + repr(x) + ' in rho\n'
> current_other_rho_text = svntest.main.file_read(other_rho_path)
> svntest.main.file_write(other_rho_path,
> other_rho_text + current_other_rho_text)
> @@ -1258,7 +1258,7 @@ def merge_with_implicit_target_helper(sb
> orig_mu_text = svntest.tree.get_text(mu_path)
> added_mu_text = ""
> for x in range(2,11):
> - added_mu_text = added_mu_text + 'This is line ' + `x` + ' in mu\n'
> + added_mu_text = added_mu_text + 'This is line ' + repr(x) + ' in mu\n'
> svntest.main.file_append(mu_path, added_mu_text)
>
> # Create expected output tree for initial commit
> @@ -1375,7 +1375,7 @@ def merge_with_prev (sbox):
> orig_mu_text = svntest.tree.get_text(mu_path)
> added_mu_text = ""
> for x in range(2,11):
> - added_mu_text = added_mu_text + '\nThis is line ' + `x` + ' in mu'
> + added_mu_text = added_mu_text + '\nThis is line ' + repr(x) + ' in mu'
> added_mu_text += "\n"
> svntest.main.file_append(mu_path, added_mu_text)
>
>
> Modified: trunk/subversion/tests/cmdline/svntest/actions.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/svntest/actions.py?pathrev=33338&r1=33337&r2=33338
> ==============================================================================
> --- trunk/subversion/tests/cmdline/svntest/actions.py Sun Sep 28 16:32:18 2008 (r33337)
> +++ trunk/subversion/tests/cmdline/svntest/actions.py Sun Sep 28 16:48:00 2008 (r33338)
> @@ -1439,7 +1439,7 @@ def fill_file_with_lines(wc_path, line_n
> # Generate the new contents for the file.
> contents = ""
> for n in range(line_nbr, line_nbr + 3):
> - contents = contents + line_descrip + " " + `n` + " in '" + \
> + contents = contents + line_descrip + " " + repr(n) + " in '" + \
> os.path.basename(wc_path) + "'.\n"
>
> # Write the new contents to the file.
>
> Modified: trunk/subversion/tests/cmdline/svntest/main.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/svntest/main.py?pathrev=33338&r1=33337&r2=33338
> ==============================================================================
> --- trunk/subversion/tests/cmdline/svntest/main.py Sun Sep 28 16:32:18 2008 (r33337)
> +++ trunk/subversion/tests/cmdline/svntest/main.py Sun Sep 28 16:48:00 2008 (r33338)
> @@ -1176,7 +1176,7 @@ def run_one_test(n, test_list, parallel
> """
>
> if (n < 1) or (n > len(test_list) - 1):
> - print "There is no test", `n` + ".\n"
> + print "There is no test", repr(n) + ".\n"
> return 1
>
> # Run the test.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: svn-help_at_subversion.tigris.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-29 03:35:10 CEST