Skip to content

Commit

Permalink
Added Hand.get_public_string()
Browse files Browse the repository at this point in the history
  • Loading branch information
von committed Nov 13, 2010
1 parent eb7d078 commit 1a17bd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyPoker/Hand.py
Expand Up @@ -90,6 +90,10 @@ def __str__(self):
string += " xx"
return string.strip()

def get_public_string(self):
"""Return a string representation of the hand as seen publicly"""
return " ".join(["XX" for card in self])

def copy(self):
"""Return a copy of this Hand."""
import copy
Expand Down
7 changes: 7 additions & 0 deletions unittests/test-Hand.py
Expand Up @@ -38,6 +38,13 @@ def testCombinations(self):
count=10,
assert_item_function=lambda i: len(i)==2)

def test_get_public_string(self):
"""Test get_public_string() method"""
hand = Hand.fromString("9D 3C 5S")
self.assertEqual(hand.get_public_string(), "XX XX XX")
hand2 = Hand()
self.assertEqual(hand2.get_public_string(), "")

def testBoardCombinations(self):
"""Test combinations with board."""
hand = HoldEm.Hand.fromString("AD 2D")
Expand Down

0 comments on commit 1a17bd3

Please sign in to comment.