def test_decide_rps(): """ Inputs that are the correct format and length """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Rock", "Scissors") == 1
def test_checksum(): """ Inputs that are the correct format and length """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Rock", "Scissors") == 1
def test_value(): """ check that correct exception is thrown for unexpected value """ with pytest.raises(ValueError): decide_rps("Rock", "Banana") with pytest.raises(ValueError): decide_rps("asdj", "Papppper")
def test_checksum(): """ Inputs that are the correct format """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Paper", "Scissors") == 2
def test_invalid_input(): """ invalid input """ with pytest.raises(TypeError): decide_rps("Rock", 214) with pytest.raises(ValueError): decide_rps("Rok", "Scissors")
def test_checksum(): """ Inputs that are the correct format and length """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Rock", "Scissors") == 1 # other tests #assert decide_rps("Chicken", "Cow") == 0 assert decide_rps("Scissors", "Paper") == 1
def test_input(): """ inputs that are incorrect values or types """ with pytest.raises(ValueError): decide_rps("Stones", "Paper") decide_rps("Stones", "Stones") decide_rps("Rock", 3) decide_rps(4.0, "Hi")
def test_rps(): """ check that expected input behaves correctly """ assert decide_rps("Rock", "Rock") == 0 assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Scissors", "Rock") == 2 assert decide_rps("Paper", "Paper") == 0 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Paper", "Rock") == 1
def test_checksum(): """ Inputs that are valid """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Scissors", "Rock") == 2 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Paper", "Paper") == 0 assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Rock", "Rock") == 0
def test_checksum(): """ Inputs give the correct result """ assert decide_rps('Rock', 'Paper') == 2 assert decide_rps('Scissors', 'Scissors') == 0 assert decide_rps('Rock', 'Scissors') == 1 assert decide_rps('Rock', 'Rock') == 0 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Paper", "Paper") == 0 assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Scissors", "Rock") == 2
def test_invalid_params(): """ Inputs that are not valid game moves """ with pytest.raises(ValueError): decide_rps("Rock", "Cheeses") with pytest.raises(ValueError): decide_rps("Sword", "Giraffe") with pytest.raises(ValueError): decide_rps(1, 4) with pytest.raises(ValueError): decide_rps(4.0, "Rock")
def test_rules(): """ Inputs that are the correct format and length """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Scissors", "Rock") == 2 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Scissors", "Scissors") == 0 # Test when parameters are the same assert decide_rps("rock", "scissors") == 1 # Lowercase parameters become capitalized and should pass
def test_checksum(): Inputs that are the correct format and length assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Rock", "Scissors") == 1 # other tests with pytest.raises(TypeError): decide_rps(1.0,2.0) with pytest.raises(ValueError): decide_rps("Lion","Tiger") decide_rps("Deer","Rock") """
def test_checksum(): """ Inputs that output the correct results """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Rock", "Scissors") == 1 # other tests assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Paper", "Paper") == 0 assert decide_rps("Rock", "Rock") == 0 assert decide_rps("Scissors", "Paper") == 1
def test_input(): """ Inputs are one of the valid choices """ with pytest.raises(TypeError): decide_rps("roc", "scissors") with pytest.raises(TypeError): decide_rps("paper","stone") with pytest.raises(TypeError): decide_rps(1, 2) with pytest.raises(TypeError): decide_rps(3, "rock")
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): decide_rps(1, 2) with pytest.raises(TypeError): decide_rps(1, "Paper") # other tests with pytest.raises(ValueError): decide_rps("Spark", "Lizard") with pytest.raises(ValueError): decide_rps("Pen", "Fish")
def test_input(): """ Inputs are one of the valid choices """ with pytest.raises(TypeError): decide_rps("roc", "scissors") with pytest.raises(TypeError): decide_rps("paper", "stone") with pytest.raises(TypeError): decide_rps(1, 2) with pytest.raises(TypeError): decide_rps(3, "rock")
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): decide_rps(3, 4) # Test input is a integer with pytest.raises(TypeError): decide_rps(3.0, 4.0) # Test input is a float with pytest.raises(TypeError): decide_rps("Rock") # Case where only one parameter is passed. with pytest.raises(ValueError): decide_rps("Rocks", "Paper") # Incorrect Spelling
def test_rules(): """ Inputs that are the correct format and length """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Scissors", "Rock") == 2 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Scissors", "Scissors") == 0 # Test when parameters are the same assert decide_rps( "rock", "scissors" ) == 1 # Lowercase parameters become capitalized and should pass
def test_decide_rps(): """ Inputs that are the correct format and length """ # Tie: assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Rock", "Rock") == 0 assert decide_rps("Paper", "Paper") == 0 # Win: assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Paper", "Rock") == 1 # Loss: assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Scissors", "Rock") == 2
def test_decide_rps(): """ Inputs that are valid (have the correct format and length) """ # Case - Player 1 Wins assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Scissors", "Paper") == 1 # Case - Player 2 Wins assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Scissors", "Rock") == 2 assert decide_rps("Paper", "Scissors") == 2 # Case - Ties assert decide_rps("Rock", "Rock") == 0 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Paper", "Paper") == 0
def test_type(): """ check that correct exception is thrown for bad type """ with pytest.raises(TypeError): decide_rps(2, "Banana") with pytest.raises(TypeError): decide_rps("asdj", 2) with pytest.raises(TypeError): decide_rps("Paper", 2)
def test_invalid_input(): """ Inputs that are invalid """ with pytest.raises(ValueError): assert decide_rps("Spock", "Lizard") with pytest.raises(ValueError): assert decide_rps("Spock", "Scissors") with pytest.raises(ValueError): assert decide_rps("Rock", "Lizard") with pytest.raises(ValueError): assert decide_rps(1, 5) # testing integers with pytest.raises(ValueError): assert decide_rps(5.0, 3.141) # testing floats with pytest.raises(ValueError): assert decide_rps( False, "Different data type") # testing differing data types
def test_input(): """ Inputs are of correct type """ # Invalid Type Error with pytest.raises(TypeError): decide_rps(1, "Scissors") with pytest.raises(TypeError): decide_rps("Rock", 5.5) with pytest.raises(TypeError): decide_rps(0.5, "Paper") with pytest.raises(TypeError): decide_rps(1.2, 5.4) with pytest.raises(TypeError): decide_rps("Rock", -1) # Problem with Player 1 input with pytest.raises(ValueError): decide_rps("Rockk", "Paper") with pytest.raises(ValueError): decide_rps("Scissorss", "Scissors") with pytest.raises(ValueError): decide_rps("stone", "knife") with pytest.raises(ValueError): decide_rps("Papier", "rock") with pytest.raises(ValueError): decide_rps("Rook", "paper") # Problem with Player 2 input with pytest.raises(ValueError): decide_rps("Scissors", "Door") with pytest.raises(ValueError): decide_rps("Paper", "5.2") with pytest.raises(ValueError): decide_rps(0.25, "Rock") with pytest.raises(ValueError): decide_rps("Papier", "Rox") with pytest.raises(ValueError): decide_rps(-1, "Stone")
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(ValueError): decide_rps("Paper", "Stone") with pytest.raises(ValueError): decide_rps("Pap", "Roc") with pytest.raises(ValueError): decide_rps("Scissors", "Papers") with pytest.raises(ValueError): decide_rps("Sisors", "Paper") with pytest.raises(ValueError): decide_rps("Paper", "Block") with pytest.raises(TypeError): decide_rps(1, 11)
def test_checksum(): """ Inputs that are the correct format and length """ #Check Correct assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Rock", "Rock") == 0 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Scissors", "Rock") == 2 assert decide_rps("Paper", "Paper") == 0 assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Paper", "Scissors") == 2 #Check Incorrect assert decide_rps(1, 2) == 0 assert decide_rps("Pi","Scu") == 2
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): decide_rps(1, 2) # integer decide_rps(1, "Rock") # player1 integer decide_rps("Rock", 1) # player2 integer decide_rps(1.2, 2.3) # float decide_rps(1.2, "Paper") # player1 float decide_rps("Paper", 2.3) # player2 float with pytest.raises(ValueError): decide_rps("papah", "Rock") # misspelled player1 decide_rps("Rock", "papah") # misspelled player2 decide_rps("P", "R") # not full word decide_rps("player1", "player2") # incorrect input
def test_input(): """ Incorrect inputs """ with pytest.raises(ValueError): decide_rps("Apple", "Ball") decide_rps("Roc", "Papr") decide_rps("Scissors", "Papper") decide_rps("Ppr", "Scissors") decide_rps("", "Scissors") decide_rps("Rock", "") decide_rps("Scissor," "Paper") decide_rps("Scissor", "Scissor") decide_rps("Stone", "Stone") decide_rps("Scissor", "Stone") with pytest.raises(TypeError): decide_rps(2, 5) decide_rps("Rock", 12) decide_rps("Paper", 6.0) decide_rps(8.4, 12.2) decide_rps(.12, .02) decide_rps(9.5, "Paper") decide_rps("", "") decide_rps() decide_rps("", 12)
def test_input(): """ Inputs that are the correct value and type """ with pytest.raises(ValueError): decide_rps("Rock", "Sissors") decide_rps("Roc", "Scissors") decide_rps("something", "else") with pytest.raises(TypeError): decide_rps(2, "Scissors") decide_rps("Rock", 2.09) decide_rps(2.9876, 3.0987)
def test_rps(): """ Inputs that are the correct format and length """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Rock", "Rock") == 0 assert decide_rps("Scissors", "Paper") == 2 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Paper", "Paper") == 0 # Inputs that are incorrect format and length with pytest.raises(NameError): decide_rps("Rock", "Spock")
def test_checksum(): """ Inputs that are the correct format and length """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Rock", "Scissors") == 1 #inputs that output TypeError and ValueError with pytest.raises(TypeError): decide_rps(3, 4) with pytest.raises(ValueError): decide_rps("rock", "Paper") with pytest.raises(ValueError): decide_rps("scissors", "paper") with pytest.raises(TypeError): decide_rps(3, "Paper") with pytest.raises(TypeError): decide_rps("PAPER", "paper")
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): decide_rps(2.0, 1) decide_rps(-234, 4.89) with pytest.raises(ValueError): decide_rps("1", "") decide_rps("abc", "stone") decide_rps("error", "paper") decide_rps("paper","rock")
def test_input(): """ Inputs that are the correct value and type """ with pytest.raises(ValueError): decide_rps("Rock","Sissors") decide_rps("Roc", "Scissors") decide_rps("something", "else") with pytest.raises(TypeError): decide_rps(2,"Scissors") decide_rps("Rock", 2.09) decide_rps(2.9876, 3.0987)
def test_decide_rps(): """ Inputs that are the correct format and length. All correct cases covered """ # Positive tests assert decide_rps("Rock", "Rock") == 0 assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Paper", "Paper") == 0 assert decide_rps("Paper", "Paper") == 2 assert decide_rps("Scissors", "Rock") == 2 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Scissors", "Scissors") == 0 # Negative tests assert decide_rps("Rock", "Rock") == 1 assert decide_rps("Paper", "Paper") == 2 assert decide_rps("Rock", "Paper") == 1 assert decide_rps("Paper", "Scissors") == 0 assert decide_rps("Paper", "Rock") == 2 assert decide_rps("Paper", "Paper") == 2 # One or more input is not a string: with pytest.raises(TypeError): decide_rps(1, "string!") with pytest.raises(TypeError): decide_rps("string!", 1) with pytest.raises(TypeError): decide_rps(80.0, 9) # One or more inputs are not valid moves: with pytest.raises(ValueError): decide_rps("rock", "Scissors") with pytest.raises(ValueError): decide_rps("Paper", "rock") with pytest.raises(ValueError): decide_rps("cqaefvcurbcwwr", "cwncuwctwruybtwub")
def test_rps(): """ Inputs that are the correct format and length """ assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Rock", "Rock") == 0 assert decide_rps("Scissors", "Rock") == 2 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Paper", "Rock") == 1 assert decide_rps("Paper", "Paper") == 0 # Inputs that are incorrect format and length with pytest.raises(TypeError): decide_rps("Rock", 1) with pytest.raises(TypeError): decide_rps(200, "Paper") with pytest.raises(TypeError): decide_rps("Scissors", 5.48) with pytest.raises(ValueError): decide_rps("Rock", "Spock") with pytest.raises(ValueError): decide_rps("Lizard", "Paper")
def test_checksum(): """ Inputs that are the correct format and length """ # check that expected input behaves correctly assert decide_rps("Rock", "Rock") == 0 assert decide_rps("Rock", "Paper") == 2 assert decide_rps("Rock", "Scissors") == 1 assert decide_rps("Scissors", "Scissors") == 0 assert decide_rps("Scissors", "Paper") == 1 assert decide_rps("Scissors", "Rock") == 2 assert decide_rps("Paper", "Paper") == 0 assert decide_rps("Paper", "Scissors") == 2 assert decide_rps("Paper", "Rock") == 1 # check that correct exception is thrown for bad value with pytest.raises(ValueError): decide_rps("Rock", "Banana") == 1 # check that correct exception is thrown for bad type with pytest.raises(TypeError): decide_rps("Rock", 2) == 1
def test_inputs(): """ Inputs that are incorrect format """ with pytest.raises(TypeError): # One of the input is not string value decide_rps(1, "Rock") with pytest.raises(TypeError): decide_rps("Rock", 1) with pytest.raises(TypeError): #Float and integer passed decide_rps(2.231, 1) with pytest.raises(TypeError): decide_rps("Rock", False) with pytest.raises(TypeError): # Boolean Value Passed decide_rps(True, "Rock") # One of the player input is wrong string value with pytest.raises(ValueError): decide_rps("Rock", "P") with pytest.raises(ValueError): decide_rps("R", "Paper") # One of the player input's first character is not capitalized properly with pytest.raises(ValueError): decide_rps("rock", "Paper") with pytest.raises(ValueError): decide_rps("Rock", "paper") # One of the player input is numeric string value with pytest.raises(ValueError): decide_rps("1", "2") with pytest.raises(ValueError): decide_rps("Rock", "1")
def test_value_decide_rps(): with pytest.raises(ValueError): decide_rps("RCK", "Paper") with pytest.raises(ValueError): decide_rps("Rock", "Pper")
def test_type_decide_rps(): with pytest.raises(TypeError): decide_rps(14, 15) with pytest.raises(TypeError): decide_rps(13.2, 25.4)
def test_input(): """ Inputs that are the incorrect format and length """ with pytest.raises(TypeError): decide_rps(23, 34) decide_rps([2], [56]) decide_rps([-1], [2]) with pytest.raises(ValueError): decide_rps("paper", "rocks") decide_rps("rock", "papers") decide_rps("dogs", "cats")