mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Better fix for SourceForge bug #31.
See https://sourceforge.net/p/pysolfc/bugs/31/ . Thanks to Caelia Renee Chapin for the fix and to Kevin Knerr for the report. Test case by @shlomif.
This commit is contained in:
parent
1fbdc2db98
commit
c0076b5b36
3 changed files with 19 additions and 2 deletions
|
@ -329,7 +329,7 @@ class Rachel(pysollib.game.StartDealRowAndCards, RelaxedSpider):
|
||||||
# * Scorpion Tail - building down by alternate color
|
# * Scorpion Tail - building down by alternate color
|
||||||
# ************************************************************************
|
# ************************************************************************
|
||||||
|
|
||||||
class Scorpion_RowStack(Spider_RowStack, Yukon_SS_RowStack):
|
class Scorpion_RowStack(Yukon_SS_RowStack, Spider_RowStack):
|
||||||
canDropCards = Spider_RowStack.canDropCards
|
canDropCards = Spider_RowStack.canDropCards
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2474,6 +2474,8 @@ class BasicRowStack(OpenStack):
|
||||||
|
|
||||||
# Abstract class.
|
# Abstract class.
|
||||||
class SequenceRowStack(SequenceStack_StackMethods, BasicRowStack):
|
class SequenceRowStack(SequenceStack_StackMethods, BasicRowStack):
|
||||||
|
canMoveCards = OpenStack.canMoveCards
|
||||||
|
|
||||||
def __init__(self, x, y, game, **cap):
|
def __init__(self, x, y, game, **cap):
|
||||||
kwdefault(cap, max_move=999999, max_accept=999999)
|
kwdefault(cap, max_move=999999, max_accept=999999)
|
||||||
BasicRowStack.__init__(self, x, y, game, **cap)
|
BasicRowStack.__init__(self, x, y, game, **cap)
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Mock_S_Game:
|
||||||
|
|
||||||
|
|
||||||
class MyTests(unittest.TestCase):
|
class MyTests(unittest.TestCase):
|
||||||
def test_import(self):
|
def test_canMoveCards(self):
|
||||||
g = MockGame()
|
g = MockGame()
|
||||||
stack = Scorpion_RowStack(0, 0, g)
|
stack = Scorpion_RowStack(0, 0, g)
|
||||||
cards = [
|
cards = [
|
||||||
|
@ -53,3 +53,18 @@ class MyTests(unittest.TestCase):
|
||||||
stack.addCard(c)
|
stack.addCard(c)
|
||||||
stack.canMoveCards(stack.cards[6:])
|
stack.canMoveCards(stack.cards[6:])
|
||||||
self.assertTrue(stack)
|
self.assertTrue(stack)
|
||||||
|
|
||||||
|
def test_canMoveCards_non_top(self):
|
||||||
|
g = MockGame()
|
||||||
|
stack = Scorpion_RowStack(0, 0, g)
|
||||||
|
cards = [
|
||||||
|
AbstractCard(1000+r*100+s*10, 0, s, r, g)
|
||||||
|
for s, r in [(2, 5), (3, 7), (2, 7), (2, 0),
|
||||||
|
(2, 3), (2, 4), (1, 4)]
|
||||||
|
]
|
||||||
|
for c in cards:
|
||||||
|
c.face_up = True
|
||||||
|
c.item = MockItem()
|
||||||
|
stack.addCard(c)
|
||||||
|
self.assertTrue(stack.canMoveCards(stack.cards[4:]))
|
||||||
|
self.assertTrue(stack)
|
||||||
|
|
Loading…
Add table
Reference in a new issue