Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Could you help me to fix the problems? The test code crashes when it runs throught removeOneOfItem -untitled , Baglist.py) Aurittest BogTest.testRemoveOne a Project untitled
Could you help me to fix the problems? The test code crashes when it runs throught removeOneOfItem
-untitled , Baglist.py) Aurittest BogTest.testRemoveOne a Project untitled ~/untitled class Bag def _init_(self): selt . storage list() BagList.py test-Bag.py 1111 External Libraries make bag as an iterator def iter(selt): for element in self.storage: yield elerent adding one element into bag def insertiself, elenent): 10 self.storage.append(elenent) 12 13 14 15 get countOf a type of elements in the bag def countofiselt, elenent): countNum = 0 for i in range en(self.storage): 17 18 19 20 21 if self.storage [1] element: countNun 1 return countNun 23 # remove one of the item return True if element got removed; # return False if element not found Itentself, elenent): def 26 27 28 29 30 31 32 for 1 in range(Len(self.storage)): assert isinstance(elenent if self.sto rageli! = element; self.storage [1] self.storage.pop( return True self. Storage [-1] return False 34 35 36 remove all of the item def removeAllotIten(self, elenent): Run: Unittests in test Bag Unittest BagTest.testRemoveOne - 1 test failed-0ms Test Results /Library/Frameworks/Python. Tramework/Versions/3.6/bin/python3.6 "/Applications/PyCharm CE.app/Contents/helpers/pycharm/utrunner-py" Usersike/untitled/te o test-Bag.BagTest testRemoveOne oms Testing started at 14:2 ..- oms Error Traceback (most recent call last): File" , line 70, in testRemoveOne b. renoveOneorItem(3) File "Users/mike/untitLed/BagList.py" line 28, in removeDneofItem assert isinstance(element) TypeError: isinstance expected 2 argunents, got 1 Process finished with exit code 0 Parameter class or type or tuple' unfilled 28:39 LF: UTF-8Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started