class TestPlayerHuman: IS_COMP = False NAME_PLAYER = "Владимир" LEN_90 = 90 def setup(self): random.seed(88) self.player = Player() self.player.create_game_card(self.NAME_PLAYER, self.IS_COMP) def teardown(self): pass def test_create_game_card(self): assert self.player.name == self.NAME_PLAYER assert self.player.is_computer == self.IS_COMP assert self.player.lost == False assert self.player.is_computer == False def test_check_number(self): assert self.player.check_number(10) == False assert self.player.check_number(16) == True assert self.player.check_number(0) == True assert self.player.check_number(-1) == False def test_examination_number(self): numb = 0 for i in range(1, self.LEN_90): if not self.player.check_number(i): # Если значения нет, а игрок сказал вычеркнуть значение = проиграл numb = i break self.player.examination_number(numb) assert self.player.lost == True, "Игрок должен проиграть при проверке отсутствующего значения"
class TestPlayerComp: IS_COMP = True NAME_PLAYER = "Компьютер 1" def setup(self): random.seed(88) self.player = Player() self.player.create_game_card(self.NAME_PLAYER, self.IS_COMP) def teardown(self): pass def test_create_game_card(self): assert self.player.name == self.NAME_PLAYER assert self.player.is_computer == self.IS_COMP assert self.player.lost == False assert self.player.is_computer == True def test_check_number(self): assert self.player.check_number(10) == False assert self.player.check_number(16) == True assert self.player.check_number(0) == True assert self.player.check_number(-1) == False