failing tests for removing items from lists and dicts

Bug #525366 reported by David Glick on 2010-02-21
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Pynie
Undecided
Unassigned

Bug Description

I was also inspired by your talk to try out pynie, and ended up adding a couple tests demonstrating that you can't yet use "del" to remove items from lists or dicts.

David Glick (davisagli) wrote :
Allison Randal (allison) wrote :

Wonderful, thanks! The two added tests didn't pass on Python 3.1 either (run the test file directly 'python3 lists.py' and 'python3 dicts.py') so I modified them. Once they passed on python3, they also passed on pynie. I've committed the modified test patch (attached). If the modified tests don't exercise the same edge cases as the original tests, more tests are welcome. Thanks!

David Glick (davisagli) wrote :

Aha, sorry for not checking against Python 3.1. However, with a fresh checkout and build of pynie (since I saw you committed the tests) I'm still getting failures when running these tests with pynie. Am I missing some step in re-building pynie? (I did 'svn up; python setup.py build') Thanks!

Allison Randal (allison) wrote :

Okay, I've got the semantics right to expose the failures now, will commit fixes to make the test pass. Thanks!

Allison Randal (allison) wrote :

I committed the fix for deleting keys in revision 113. The new lists test is now passing. The dict test is failing, but it's because of a bug in "if...in" (which reports true no matter what you put in the string). The dict key is actually removed by del now, as shown by the test I added in revision 114. Will fix the 'in' test next.

David Glick (davisagli) wrote :

Cool, thanks. Not sure if you found the cause of the problem with 'in' already, but in case it helps, here's an interpreter session where I was noticing weirdness with it:

davisagli:pynie davidg$ ./pynie
Pynie: a Python compiler for Parrot.
>>> a = {'bar':1}
>>> 'bar' in a
Unable to set lvalue on PAST::Val node
>>> 'bar' not in a
Unable to set lvalue on PAST::Val node
>>> print('bar' in a)
bar

where expected output would be:

>>> davisagli:pynie davidg$ python3.1
Python 3.1.1 (r311:74480, Feb 22 2010, 17:09:30)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = {'bar':1}
>>> 'bar' in a
True
>>> 'bar' not in a
False
>>> print('bar' in a)
True

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers