#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=E0401 # pylint: disable=E0401 """ Welcome In Pig Dice!. The game is easy. Try to roll the dice and not gitting values 1 and 6, or you...

1 answer below »
Hello i really dont know what to test for main.py and shell.py. I want you to check these classes and write test the methods and anything you deem should be tested(Unit testing)


#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=E0401 # pylint: disable=E0401 """ Welcome In Pig Dice!. The game is easy. Try to roll the dice and not gitting values 1 and 6, or you lose your score and turn. The winner who reach 50 points first. To start the game, Enter 'start 1' to play against the computer 'start 2' to play with two players. If you choose to play against the computer, you are able to change the level when ever you want. I expect to change your name by entering 'name (Your Name)' Prese help or ? to get more about commands """ import shell if __name__ == '__main__': print(__doc__) shell.Shell().cmdloop() # !/usr/bin/env python3 # -*- coding: utf-8 -* """ Controls the intelligence computer player. According to chosen level the class make decision for next movement. """ import random class Intelligence(): """Intelligence Class.""" orders = (True, False, True) def __init__(self, level): """Initialize levels.""" self.level = level def act_easy(self): """Return decision as an easy level.""" return random.choice(self.orders) def act_normal(self, player): """Control decision when level is Normal.""" if player.get_score() < 10:="" print("computer:="" hmmmmm,="" my="" score="" is="" low="" anyway!!")="" return="" true="" return="" self.act_easy()="" def="" act_hard(self,="" value):="" """notice="" that="" the="" computer="" has="" ability="" to="" cheat."""="" if="" self.cheat_decison()="" and="" value="" not="" in="" (1,="" 6):="" print("computer:="" i="" think="" my="" score="" gonna="" be="" higher="" now!")="" return="" true="" if="" self.cheat_decison()="" and="" value="" in="" (1,="" 6):="" print("bst="" bst="" --=""> Computer CHEATS!!") return False print("Computer: I'm NOT a cheater like you!!") return self.act_easy() def get_inti_decision(self, player, dice_value): """Return a method using currying approach to set level.""" if self.level == "normal": return self.act_normal(player) if self.level == "hard": return self.act_hard(dice_value) return self.act_easy() def cheat_decison(self): """ Create computer decision about cheating. Use same boolean tuple to init decision. """ return random.choice(self.orders) #!/usr/bin/env python3 # -*- coding: utf-8 -* # pylint: disable=E0401 """Player Class to control player objects create in game.""" from intelligence import Intelligence class Player(): """Player Class.""" reaction = Intelligence(None) def __init__(self, name, decision): """Accept player's name and create score.""" self.name = name self.score = 0 self.score_list = [] self.decision = decision def change_score(self, score): """Change player score according to dice dance.""" if score not in (1, 6): self.score += score else: print("OBS!!\n") self.score *= 0 def set_name(self, name): """Change plyer name.""" self.name = name def set_level(self, level): """Set computer's level.""" self.reaction.level = level def get_name(self): """Return player name.""" return self.name def get_score(self): """Return player score.""" return self.score def set_score_list(self, num): """Set score list.""" self.score_list.append(num) def get_score_list(self): """Return score list.""" return self.score_list Hello I want you to help me write unit test for main.py and shell.py classes respectively as I have so many stuff to do please.
Answered Same DayMar 16, 2021

Answer To: #!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: disable=E0401 # pylint: disable=E0401 """...

Pratap answered on Mar 17 2021
142 Votes
1. main.pt has no functions or method. It is used to execute the command loop.
So main.py doesn't i
nclude in testing.
2. As of shell.py, some of the methods doesn't return any values. Those inturn calls other functions/methods.
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here