On 19/07/17 16:01, Sydney Shall wrote:
> I am learning to use unittest.
> 

>   def test_zero_in_capitalsadvanced(self):
>          self.assertIn(self.capitalsadvanced, 0.0)

Remember the interpreter...


>>> help(unittest.case.assertIn)
Help on function assertIn in module unittest.case:

assertIn(self, member, container, msg=None)
    Just like self.assertTrue(a in b), but with a nicer default message.
~

> The error message is:
> 
>      self.assertIn(self.capitalsadvanced, 0.0)
>    File "/Users/sydney/anaconda/lib/python3.6/unittest/case.py", line 
> 1077, in assertIn
>      if member not in container:
> TypeError: argument of type 'float' is not iterable

The obvious float is 0.0
The likely container is self.capitalsadvanced

They are reversed according to the help screen.

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to