''' DS2000 Spring 2020 Source code from class -- testing GoT functions Any man who must say, 'I am the king,' is no true king ''' # Un-comment one of the below import # statements to test v1 or v2 of the function # Uncomment this to import from got to test the v1 of the function # from got import is_finale # Uncomment this to import from v2 of the function instead # from got_v2 import is_finale def test_final_ep(season, ep, expected): ''' Function test_final_ep Parameters: values to pass to final_ep function, both ints (one for season number, one for episode number), plus the expected output, a boolean Returns: True if test passed, False otherwise ''' print('Testing inputs:', season, ',', ep, '.' 'Expecting result:', expected) actual = is_finale(season, ep) print('...actual result:', actual, '\n') return expected == actual def test_all_final_ep(): ''' Function test_all_final_ep Parameters: none Returns: Number of tests that failed ''' num_fail = 0 # Test One: Season 1, Ep 1 is not the finale if not test_final_ep(1, 1, False): num_fail += 1 # Test Two: Season 1, Ep 10, is the finale if not test_final_ep(1, 10, True): num_fail += 1 # Test Three: Season 2, Ep 10 is the finale if not test_final_ep(2, 10, True): num_fail += 1 # Test Four: Season 7, Ep 6 is not the finale if not test_final_ep(7, 6, False): num_fail += 1 # Test Five: Season 8, Ep 6 is the finale if not test_final_ep(8, 6, True): num_fail += 1 # Test Six: Season 8, Ep 1 is not the finale if not test_final_ep(8, 1, False): num_fail += 1 return num_fail def main(): fail_tests = test_all_final_ep() if fail_tests == 0: print('All tests passed, great job!') else: print(fail_tests, 'failed :( Go back and fix pls.\n') main()