[PATCH 1 of 5] checkwinfilename: use %r in format string

Mads Kiilerich mads at kiilerich.com
Sat Apr 16 09:51:15 CDT 2011


Adrian Buehlmann wrote, On 04/16/2011 02:35 PM:
> # HG changeset patch
> # User Adrian Buehlmann<adrian at cadifra.com>
> # Date 1302876923 -7200
> # Node ID fb38be10ed99f8499b7fff0c1cbb5f5a505deedf
> # Parent  924f40b977ee72ef7a3c1dce38b6aaa8c24198cd
> checkwinfilename: use %r in format string
>
> and adding doctests for \n and \r
>
> diff --git a/mercurial/util.py b/mercurial/util.py
> --- a/mercurial/util.py
> +++ b/mercurial/util.py
> @@ -511,8 +511,12 @@
>       "filename contains 'AUX', which is reserved on Windows"
>       >>>  checkwinfilename("foo/bar/bla:.txt")
>       "filename contains ':', which is reserved on Windows"
> ->>>  checkwinfilename("foo/bar/b\07la.txt")
> -    "filename contains '\\x07', which is invalid on Windows"
> +>>>  checkwinfilename("foo/bar/jj\\07jj.txt")
> +    "filename contains '\\\\x07', which is invalid on Windows"
> +>>>  checkwinfilename("foo/bar/jj\\njj.txt")
> +    "filename contains '\\\\n', which is invalid on Windows"
> +>>>  checkwinfilename("foo/bar/jj\\rjj.txt")
> +    "filename contains '\\\\r', which is invalid on Windows"
>       >>>  checkwinfilename("foo/bar/bla ")
>       "filename ends with ' ', which is not allowed on Windows"
>       '''

A raw string docstring could perhaps make these doctests a bit more 
readable.

/Mads


More information about the Mercurial-devel mailing list