[Tutor] unitest with random inputs

Steven D'Aprano steve at pearwood.info
Wed Jul 19 12:42:16 EDT 2017

On Wed, Jul 19, 2017 at 05:01:53PM +0200, Sydney Shall wrote:

>  def test_zero_in_capitalsadvanced(self):
>         self.assertIn(self.capitalsadvanced, 0.0)
> The error message is:
> Traceback (most recent call last):
> in assertIn
>     if member not in container:
> TypeError: argument of type 'float' is not iterable

You are trying to test whether capitalsadvanced is in 0.0. Reverse the 

        self.assertIn(0.0, self.capitalsadvanced)

which will test whether 0.0 is in self.capitalsadvanced.

> FAILED (failures=9, errors=1)
> The failures all arise from a 'nan'.
> It is this problem that I am trying to resolve.

Well, since you don't show us what those failing tests are, we cannot 
possibly tell you how to fix them.

Start by showing us *one* failing test, and what the failure is.


More information about the Tutor mailing list