Question: BlockPy: 4 ) Scariest Place In the code below, you need to write unit tests to evaluate a function named scariest _ place. scariest _
BlockPy: Scariest Place
In the code below, you need to write unit tests to evaluate a function named scariestplace.
scariestplaceplaces: listPlace str: Consumes a list of Place and produces the name of the Place that has the most monsters. The list of Place might have a Place with the name "exit" when this place is encountered, the rest of that list AFTER the Exit place should be ignored. If more than one Place has the most monsters, return the one that is later in the list. If there are no places available, then return the string "none" instead.
Do not modify the definition of Place.
Remember: You should not implement the scariestplace function yourself! Write the tests!
Feedback with no code:
Feedback:
Failed Instructor Test
I ran your test cases against some of my own implementations of scariestplace.
I had programs I expected to pass, and programs I expected to fail.
Your tests did not pass of my genuine programs.
Your tests did not catch of my impostor programs.
Here are the names for the genuine programs that incorrectly failed on your test cases:
Correct Program #
Here are the names for the impostor programs that incorrectly passed your tests:
Failed Wrong Program # Hint: Returns last Failed Wrong Program
# Hint: Grabbed last exit Failed Wrong Program
# Hint: Not actually taking Failed Wrong Program
# Hint: Not taking the exit Failed Wrong Program
# Hint: Filtering instead of Taking Failed Wrong Program
# Hint: No places. Failed Wrong Program
# Hint: Min vs Max Failed Wrong Program
# Hint: Breaking ties Failed Wrong Program
# Hint: This wrong program expects an exit but exit is optional
Code given:
from bakery import assertequal
from dataclasses import dataclass
# Do not modify this definition
@dataclass
class Place:
name: str
monsters: liststr
# NOTE
# Assume that the function scariestplace is already defined!
# Do NOT write scariestplace yourself!
# ONLY write the assertequal statements below!
assertequalscariestplace
assertequalscariestplace
# Write some more too!
My code:
assertequalscariestplace
PlaceDungeonmonster
PlaceForestmonster "monster
PlaceCastlemonster
"Forest"
assertequalscariestplace
PlaceDungeonmonster "monster
PlaceForestmonster "monster
Placeexit
"Forest"
assertequalscariestplace
PlaceDungeon
PlaceForest
PlaceCastle
"Castle"
assertequalscariestplace
PlaceDungeonmonster
Placeexit
PlaceForestmonster "monster
"Dungeon"
assertequalscariestplace "none"
assertequalscariestplace
PlaceDungeonmonster
PlaceForestmonster "monster "monster
PlaceCastlemonster "monster
"Forest"
assertequalscariestplace
PlaceDungeonmonster "monster
PlaceForestmonster "monster
PlaceCastlemonster "monster
"Castle"
assertequalscariestplace
PlaceDungeonmonster
PlaceForestmonster "monster
PlaceCastlemonster "monster
"Castle"
assertequalscariestplace
PlaceDungeonmonster
PlaceForestmonster
Placeexit
PlaceCastlemonster "monster
"Forest"
assertequalscariestplace
PlaceDungeonmonster
Placeexit
PlaceCastlemonster "monster
Placeexit
PlaceForestmonster "monster
"Dungeon"
assertequalscariestplace
PlaceDungeonmonster
PlaceForestmonster
PlaceCastlemonster "monster
Placeexit
"Castle"
assertequalscariestplacePlaceexit "none"
assertequalscariestplace
PlaceDungeonmonster
Placeexit
PlaceCastlemonster "monster "monster
"Dungeon"
Does not work, keeps saying:
Feedback:
Failed Instructor Test
I ran your test cases against some of my own implementations of scariestplace.
I had programs I expected to pass, and programs I expected to fail.
Your tests did not pass of my genuine programs.
At least one of your tests correctly failed for all of my impostor programs.
Here are the names for the genuine programs that incorrectly failed on your test cases:
Correct Program #
I been stuck for minutes and can't figure out what I am missing, can you please review my unit test and and help me
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
