Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
unittest
#4
Quote:So when you do for item in responses:
item will be empty and you check if item is in in self.my_survey Confused
How do you get this to work i don't know.

sorry about that...
class Testing(unittest.TestCase):
   def testThis(self):
        responses = [1,2,3]#or ['a','b','c'] is fine
So are the assert methods totally recursive? What am I missing here?

b/c
#1
for item in responses:
   self.assertIn(item,self.my_survey.responses)
I would this this code would be the **only** right one.
#2
for item in responses:
   self.assertIn(item, self.my_survey.show_resp)
and this snippet also works:
#3
for item in responses:
   self.assertIn(item, self.my_survey.foo)
IDU python's internal 'mechanism'/'logic' in this example. I'd think snippet 2 only should work...but they all produce the same output.
Reply


Messages In This Thread
unittest - by mepyyeti - Dec-21-2017, 01:49 AM
RE: unittest - by squenson - Dec-21-2017, 07:56 AM
RE: unittest - by snippsat - Dec-21-2017, 03:56 PM
RE: unittest - by mepyyeti - Dec-21-2017, 04:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Unittest roadrage 0 1,652 Feb-14-2019, 06:11 AM
Last Post: roadrage

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020