From 80db96e2fb26a79ab84343fd0760ccc5d61e7848 Mon Sep 17 00:00:00 2001 From: Pamela Hathway Date: Fri, 23 Aug 2024 21:55:12 +0200 Subject: [PATCH] fixes bug that colour checking introduced --- src/brewing/brew_potions.py | 4 ++-- src/brewing/inspection.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/brewing/brew_potions.py b/src/brewing/brew_potions.py index 8aa6d60..5c27af2 100644 --- a/src/brewing/brew_potions.py +++ b/src/brewing/brew_potions.py @@ -7,7 +7,7 @@ def make_example_potion(student_name="ASPP student"): """Make and return an example potion.""" my_potion = potion_class.Potion(student_name=student_name) # Set up your old kettle and light an eternal flame underneath it. - my_potion.setup(container=containers.OLD_KETTLE, heat_source="eternal_flame") + my_potion.setup(container=containers.OLD_KETTLE, heat_source=cooking.ETERNAL_FLAME) # Simmer for 5 hours. cooking.simmer(my_potion, duration=5) print(f"You successfully ran make_example_potion, {student_name}, well done :).") @@ -24,4 +24,4 @@ if __name__ == "__main__": my_name = 'ASPP student' my_potion = make_example_potion(student_name=my_name) # Let Snape inspect the potion - inspection.inspection_by_Snape(potion=my_potion, target_potion='example_potion') + inspection.inspection_by_snoope(potion=my_potion, target_potion='example_potion') diff --git a/src/brewing/inspection.py b/src/brewing/inspection.py index 9a30567..fc5564e 100644 --- a/src/brewing/inspection.py +++ b/src/brewing/inspection.py @@ -81,7 +81,7 @@ def inspection_by_snoope(potion, target_potion='python_expert'): # pylint: disa # check that potion is cooked if potion.cooked == expected_cooked and potion.simmer_duration == expected_simmer_duration: - print('The potion is cooked properly, snoope cannot complain - he is looking annyoyed now.') + print('The potion is cooked properly, Snoope cannot complain - he is looking annyoyed now.') else: if potion.simmer_duration < expected_simmer_duration: print('Snoope smirks and remarks "Your potion is undercooked!" \n') @@ -93,12 +93,12 @@ def inspection_by_snoope(potion, target_potion='python_expert'): # pylint: disa print_delay_dots() - if potion.colour == expected_anticlock_colour: + if target_potion == 'python_expert' and potion.colour == expected_anticlock_colour: print("Professor Dimbledore unexpectedly walks through the door, sees your potion and exclaims:") print(f'"Oh my, {potion.student_name}, your potion is absolutely perfect! ') print(' You earn 1000 points and the House Cup for this year\'s ASPP Summer School!"') print('You and your class mates leave to have a butterbeer at the beach in Heraklion!') - elif potion.colour == expected_clock_colour: + elif target_potion == 'python_expert' and potion.colour == expected_clock_colour: print("Your potion does not only look disgusting, it also smells like rotten eggs. ") print("You vomit into your cauldron and while this does not change the colour, you know you will not pass the class, so you start again. ") else: