def throws_an_error_if_fibu_has_no_input(): """Makes sure fibu() throws an error if there is no input""" with raises(Exception) as err_info: fibu() # pylint: disable=no-value-for-parameter assert err_info.type == TypeError assert 'missing 1 required positional argument' in str( err_info.value)
def throws_an_error_if_no_input(): with raises(Exception) as exception_info: fibu() # pylint: disable=no-value-for-parameter assert exception_info.type == TypeError assert "missing 1 required positional argument" in str(exception_info.value) def returns_fizzbuzz_if_x_is_multiple_of_15(): """ Checks to see if an input is a multiple of 15. Returns 'FizzBuzz' if it is. Returns the input if it is not. """ assert fibu(15) == 'FizzBuzz' # multiple of 15 assert fibu(2) == 2 # non-multiple of 15 assert fibu(0) == 'FizzBuzz' # zero assert fibu(-15) == 'FizzBuzz' # negative multiple of 15 assert fibu(-4) == -4 # negative non-multiple of 15 assert fibu('Fizz') == 'Fizz' # non-number input def can_play_fizzbuzz(): """Demonstrate that we can generate the correct output for a minimal test case of the actual FizzBuzz game. """ assert play_fizzbuzz(1, 15) == [ 1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7 , 8, 'Fizz', 'Buzz', 11, 'Fizz', 13, 14, 'FizzBuzz' ]
def outputs_fizzbuzz_if_an_input_is_numeric_and_a_multiple_of_15(): """ Checks to see if the input `x` is numeric and a multiple of 15. If it is, it outputs 'FizzBuzz'. Otherwise, it outputs the input. """ assert fibu(15) == 'FizzBuzz' # multiple of 15 assert fibu(4) == 4 # non-multiple of 15 assert fibu(0) == 'FizzBuzz' # zero assert fibu(-15) == 'FizzBuzz' # negative multiple of 15 assert fibu(-2) == -2 # negative non-multiple of 15 assert fibu(5.5) == 5.5 # non-integer assert fibu('Fizz') == 'Fizz' # non-numeric
def returns_fizzbuzz_if_a_number_is_a_multiple_of_15(): """ Takes an input `x` and checks to see if it is a number, and if so, also a multiple of 15. If it is both, return 'FizzBuzz'. Otherwise, return the input. """ assert fibu(15) == 'FizzBuzz' # multiple of 15 assert fibu(2) == 2 # non-multiple of 15 assert fibu(5.5) == 5.5 # non-integer assert fibu(0) == 'FizzBuzz' # zero assert fibu(-15) == 'FizzBuzz' # negative multiple of 15 assert fibu(-4) == -4 # negative non-multiple of 15 assert fibu('Fizz') == 'Fizz' # non-numeric input
def returns_fizzbuzz_if_x_is_multiple_of_15(): """ Checks to see if an input is a multiple of 15. Returns 'FizzBuzz' if it is. Returns the input if it is not. """ assert fibu(15) == 'FizzBuzz' # multiple of 15 assert fibu(2) == 2 # non-multiple of 15 assert fibu(0) == 'FizzBuzz' # zero assert fibu(-15) == 'FizzBuzz' # negative multiple of 15 assert fibu(-4) == -4 # negative non-multiple of 15 assert fibu('Fizz') == 'Fizz' # non-number input
def throws_an_error_if_no_input(): with raises(Exception) as err_info: fibu() # pylint: disable=no-value-for-parameter assert err_info.type == TypeError assert 'missing 1 required positional argument' in str( err_info.value)