On Thu, Sep 2, 2010 at 1:01 AM, Ivanov Dmitriy <[email protected]> wrote:

> \leoEditCommands.py", line 620, in readAbbreviations
>    a, b = x.split('=', 1)
> ValueError: too many values to unpack

My apologies.  The fix, and a comprehensive new unit test, is on the
trunk at rev 3315.

Please report any further problems immediately.

Edward

P.S.  FYI, here is the new code, in a helper shared by several methods::

def addAbbrevHelper (self,s):

    if not s.strip(): return

    try:
        d = self.abbrevs
        data = s.split('=')
        name = data[0].strip()
        val = '='.join(data[1:])
        if val.endswith('\n'): val = val[:-1]
        val = val.replace('\\n','\n')
        old = d.get(name)
        if old and not g.unitTesting:
            g.es_print('redefining abbreviation',name,
                '\nfrom',repr(old),'to',repr(val))
        d [name] = val
    except ValueError:
        g.es_print('bad abbreviation: %s' % s)

And here is the new unit test::

f = c.abbrevCommands.addAbbrevHelper
d = c.abbrevCommands.abbrevs

table = (
    ('ut1','ut1=aa','aa'),
    ('ut2','ut2 =bb','bb'),
    ('ut3','ut3=cc=dd','cc=dd'),
    ('ut4','ut4= ee',' ee'),
    ('ut5','ut5= ff = gg',' ff = gg'),
    ('ut6','ut6= hh==ii',' hh==ii'),
    ('ut7','ut7=j=k','j=k'),
    ('ut8','ut8=l==m','l==m'),
)

for name,s,expected in table:
    f(s)
    result = d.get(name)
    assert result == expected, '(no nl) expected <%s>, got <%s>' % (
        expected,result)
    f(s+'\n')
    result = d.get(name)
    assert result == expected, '(nl) expected <%s>, got <%s>' % (
        expected,result)

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to