예제 #1
0
	def testIfStringEnteredAsCo_ordinate(self):
		board, error = runTheThing("+++++++++","X","faceplant",0)
		assert error == "Co-ordinate was not in the correct format. Please enter an integer."
예제 #2
0
	def testIfLost(self):
		board, error = runTheThing("x+xo+oxox","o",1,2)
		assert board.won == False
예제 #3
0
	def testForInvalidMove(self):
		board, error = runTheThing("x++++++++","x",0,1)
		assert error == "Invalid move entered (There can only be one more X than the number of Os, and vice versa)."
예제 #4
0
	def testForInvalidBoard(self):
		board, error = runTheThing("xx+++++++",None,None,None)
		assert error == "Invalid board entered (There can only be one more X than the number of Os, and vice versa)."
예제 #5
0
	def testIfCo_ordinateOver2(self):
		board, error = runTheThing("+++++++++","x",1,4)
		assert error == "You have entered an invalid co-ordinate. They must all be 0, 1 or 2."
예제 #6
0
	def testLetterInSamePlace(self):
		board, error = runTheThing("x++++++++","o",0,0)
		assert error == "There is already a letter in that position."
예제 #7
0
	def testIfCo_ordinateLessThan0(self):
		board, error = runTheThing("+++++++++","x",-1,2)
		assert error == "You have entered an invalid co-ordinate. They must all be 0, 1 or 2."
예제 #8
0
	def testIfWon(self):
		board, error = runTheThing("x+xo+oxox","o",1,1)
		assert board.won == True
예제 #9
0
	def testIfInputNotXOOrHyphen(self):
		board, error = runTheThing("+++p+++++","x",1,2)
		assert error == "Input may only contain Xs, Os or +'s."
예제 #10
0
	def testIfInputTooLong(self):
		board, error = runTheThing("+++++++++++","x",1,2)
		assert error == "Input must be nine characters long (X, O and + allowed)."
예제 #11
0
	def testIfNotXOrO(self):
		board, error = runTheThing("+++++++++","p",1,2)
		assert error == "You must place either an X or an O."
예제 #12
0
	def testIfCorrectInput(self):
		board, error = runTheThing("+++++++++","x",1,2)
		assert error == None
예제 #13
0
	def testIfNoInput(self):
		board, error = runTheThing(None, None, None, None)
		assert error == "No board entered. Please enter one."