Rafael Knuth wrote:
> I just wrote a unittest for this function here:
>
> def PositiveCalculator(*summands):
> if all(x > 0 for x in summands):
> return sum(summands)
> else:
> raise ValueError("negative value")
>
> Here's the test (I want to test whether the function works if the user
> enters floats instead of integers) :
>
> import unittest
> from all_any import PositiveCalculator
>
> class TestCalculator(unittest.TestCase):
> def test_floats(self):
> self.assertTrue(PositiveCalculator(3.45, 54.3, 5.62))
>
> if __name__ == " __main__":
> unittest.main()
>
> For some reason the test runs through without giving me any output,
> and I was wondering what I am doing wrong here?
Look at this line:
> if __name__ == " __main__":
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor