2.6 KiB
Exercise 3: Workflow
Goal
Experience that working with an editable installation does not change how you interact with your code. This is supposed to be easy and fun, so run the inspection often and make mistakes with the potion.
Use your git skills to commit the changes you made to a new branch, and create a pull request.
Tasks
-
Create a new branch.
-
In the
brew_potions.py
file complete themake_python_expert_potion
function that makes the Python expert potion (instructions below). -
In the
if _ name _ == "_ main _"
part, call the function you are editing and get Professor Snoope to inspect your potion as shown for the example potion. Callinginspection_by_snoope
should never give you an error, so you will have to read what Snoope does and says to find out what went wrong. -
Create a pull request.
Brewing instructions
Make a new potion called python_expert
according to these instructions:
1. Set up a pewter cauldron and light a fire underneath it
2. Add fish eyes, unicorn hair and tea leaves
3. Let simmer for 2 hours
4. Have snoope inspect the potion (use target_potion='python_expert').
Use the if __name__ =="__main__"
block in brew_potions.py
to create the python_expert
potion and call Snoope to inspect the potion by calling inspection_by_snoope
.
Make sure you actually call the function you are editing and change the target potion for Snoope to "python_expert"
.
Hints
-
If you don't understand the instructions, please lift your hand and we will come to explain.
-
The python expert potion is very similar to the example potion. You may copy that code and adapt it accordingly.
-
Note that if you copy from the
example_potion()
function, it is missing a crucial step. You can look at thePotion()
class inbrewing/potion_class.by
for inspiration (it has to do with the ingredients). -
Don't forget to change the name of the potion you want Snoope to check to "python_expert" when you call the inspection (in if _ name _ == "_ main _" part).
Extra credit
If you look into the code you will see that there is a cooking method that is defined in the code which we have not used. What happens if you do use it (try both options!) and let Snoope inspect your potion?
Once you are done, reflect on what you did to find out what the cooking method was
- Where did you look, why did you look there first?
- How did you figure out what it does? What part of the function did you read first?
- Did it work on your first try? If not, how did you try to fix it - trial and error or read documentation?