On Jan 13, 9:58 am, "Edward K. Ream" <[email protected]> wrote:

> Replacing the failed assert with a print statement (to allow the test
> to continue) shows that the failing child indices happen at any level.

Hahaha.  The code is/was essentially correct.  The "fix" is to realize
that c.vnode2position just returns *one* position p2 (of several
possible) positions such that p2.v == v.

Indeed the following test passes:

for p in c.allNodes_iter():
    p2 = c.vnode2position(p.v)
    # We can *not* assert that p == p2, only that
    # p2.v == p.v and c.positionExists(p2)
    assert p2.v == p.v,'p2.v: %s, p.v: %s' % (p2.v,v)
    assert c.positionExists(p2),'does not exist: %s' % p2

Note the comment in this test.

The line:

    parent = v.parents[0]

is the source of the ambiguity.  I doubt there is any reasonable way
around this.

The new code is on the trunk at rev 1393.  I've got to run now, but
when I come back I'll update leoPyRef.leo to include the new testing
code.

Edward

--~--~---------~--~----~------------~-------~--~----~
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