David James wrote:
> On Sat, Jun 20, 2009 at 3:59 PM, Neels Janosch Hofmeyr<neels_at_elego.de> wrote:
>> This is how I implemented the same test cmpilato wrote in about two minutes
>> sharp:
>>
>> [[[
>> def mine(sbox):
>> "lock a file using a comment with xml special chars"
>> svntest.factory.make(sbox, """
>> echo "This represents a binary file\\n" >> iota
>> svn ci
>> svn lock -m 'lock & load' iota
>> """)
>> ]]]
>> (Note that I had to double-escape the '\n' to '\\n' because of python
>> parsing it before factory can.)
>
> This sounds very useful! I like how it simplifies the test suite. I
> just have a drive-by suggestion for you here. If you don't want Python
> to interpret the backslashes, use raw strings. In that case, you don't
> need to double-escape. E.g.
>
> [[[
> svntest.factory.make(sbox, r"""
> echo "This represents a binary file\n" >> iota
> svn ci
> svn lock -m 'lock & load' iota
> """)
> ]]]
>
No. :)
[[[
$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print """a\nb\nc"""
a
b
c
>>>
]]]
I think triple quotes are mainly for
- not having to escape ' and " characters
- being able to imply \n by a real line break
They still interpret \-escaped characters. (heh, is this users_at_python?)
~Neels
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2363999
Received on 2009-06-21 22:53:01 CEST