Deck.remove() removes the wrong card.

Bug #892802 reported by Jo-Erlend Schinstad
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-playingcards
Confirmed
High
Unassigned

Bug Description

>>> from deck import Deck, Card
>>> testdeck = Deck()
>>> cards = testdeck.get_cards_by_name("s:234 c:5")
>>> for card in cards:
... print("Removing {0}".format(card))
...
Removing ♠2
Removing ♠3
Removing ♠4
Removing ♣5
>>> for card in cards:
... testdeck.remove(card)

>>> for card in cards:
... print("{0} in testdeck: {1}".format(card, card in testdeck))
...
♠2 in testdeck: False
♠3 in testdeck: False
♠4 in testdeck: True
♣5 in testdeck: True
>>> print(len(testdeck))
48
>>> testdeck.sort(by_suit=True)
>>> for card in testdeck:
... print card
...
♣2
♣3
♣4
♣5 <-- should've been removed.
♣6
♣7
♣8
♣9
♣10
♣J
♣Q
♣K
♣A
♦2
♦3
        <-- should NOT have been removed
♦5
♦6
♦7
♦8
♦9
♦10
♦J
♦Q
♦K
♦A
♥2
♥3
♥4
        <--- Should NOT have been removed.
♥6
♥7
♥8
♥9
♥10
♥J
♥Q
♥K
♥A
♠4 <-- Should've been removed
♠5
♠6
♠7
♠8
♠9
♠10
♠J
♠Q
♠K
♠A
>>>

Changed in python-playingcards:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Jo-Erlend Schinstad (joerlend.schinstad)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.