Ejemplo n.º 1
0
	def test_hand_keep_roll(self):
		name = 'test player'
		player = main.Player(name)
		result = main.Hand(player)
		die_a = main.Die()
		die_b = main.Die()
		die_c = main.Die()
		result.keep_roll(die_a.roll())
		result.keep_roll(die_b.roll())
		result.keep_roll(die_c.roll())

		self.assertEqual(len(result.rolls), 3)
Ejemplo n.º 2
0
	def test_hand_display_hand_not_empty(self):
		name = 'test player'
		player = main.Player(name)
		hand = main.Hand(player)
		die_a = main.Die()
		die_b = main.Die()
		hand.keep_roll(die_a.roll())
		hand.keep_roll(die_a.roll())
		result = io.StringIO()
		sys.stdout = result
		hand.display_hand()
		result = result.getvalue().rstrip()
		self.assertEqual(result.count('o'), sum(hand.rolls))
Ejemplo n.º 3
0
	def test_hand_qualified(self):
		name = 'test player'
		player = main.Player(name)
		hand = main.Hand(player)
		die_a = main.Die()
		hand.keep_roll(die_a.roll())
		result = hand.qualified()
		self.assertEqual(result, False)
Ejemplo n.º 4
0
	def test_hand_calc_score(self):
		name = 'test player'
		player = main.Player(name)
		hand = main.Hand(player)
		die_a = main.Die()
		hand.keep_roll(die_a.roll())
		hand.calc_score()
		result = hand.score
		#self.assertEqual(result, 0)
		die_b = main.Die()
		die_c = main.Die()
		die_d = main.Die()
		hand.keep_roll(die_b.roll())
		hand.keep_roll(die_c.roll())
		hand.calc_score()
		result = hand.score
		if 1 in hand.rolls and 4 in hand.rolls:
			self.assertIn(result, hand.rolls)
		else:
			self.assertEqual(result, 0)
Ejemplo n.º 5
0
	def test_die_roll(self):
		die = main.Die()
		result = die.roll()
		self.assertLessEqual(result,6)
Ejemplo n.º 6
0
	def test_die_creation(self):
		result = main.Die()
		for face in result.die:
			self.assertLessEqual(face.value, 6)