From: Brett K. <in...@us...> - 2005-08-15 06:49:56
|
Update of /cvsroot/wtfibs/WTFibs/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17922/test Modified Files: test_Backgammon.py Log Message: fixed isValidMove Index: test_Backgammon.py =================================================================== RCS file: /cvsroot/wtfibs/WTFibs/test/test_Backgammon.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- test_Backgammon.py 11 Aug 2005 00:30:28 -0000 1.4 +++ test_Backgammon.py 15 Aug 2005 06:49:48 -0000 1.5 @@ -28,13 +28,11 @@ ### import sys - +import py.test ## this way is easiest, i think ## just add the path to your working src directory to sys.path - sys.path.append("src") -import py.test import Backgammon def test_Player(): @@ -66,14 +64,6 @@ p.pop() assert len(p.checkers) == 0 assert type(p.pop()) == type(None) - - p.push(Backgammon.Checker("White")) - p.push(Backgammon.Checker("White")) - assert p.isValidDestination("White") == True - assert p.isValidDestination("Black") == False - - p.pop() - assert p.isValidDestination("Black") == True def test_Die(): d = Backgammon.Die() @@ -125,6 +115,12 @@ # Move some checkers around, make sure the counts are correct ## + assert b.isValidMove("Black",1,5) == False + assert b.isValidMove("White",13,1) == False + assert b.isValidMove("White",24,1) == True + py.test.raises(ValueError, 'b.isValidMove("Grey",1,5)') + py.test.raises(ValueError, 'b.isValidMove("White",-2,0)') + b.move(1,3) assert len(b.points[3-1].checkers) == 1 # funky indexing - this is right b.move(3,1) |