Re: [Tutor] unitest with random inputs

2017-07-19 Thread Mats Wichmann
On 07/19/2017 10:55 AM, Sydney Shall wrote: > On 19/07/2017 18:42, Steven D'Aprano wrote: >> 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:

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Peter Otten
Sydney Shall wrote: > On 19/07/2017 18:56, Steven D'Aprano wrote: >> On Wed, Jul 19, 2017 at 06:08:57PM +0200, Sydney Shall wrote: >> >>> >> >> (I haven't tested that code myself, so please try it, and if it doesn't >> work for some reason, let us know on the mailing list and somebody can >> fi

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
On 19/07/2017 18:56, Steven D'Aprano wrote: On Wed, Jul 19, 2017 at 06:08:57PM +0200, Sydney Shall wrote: (I haven't tested that code myself, so please try it, and if it doesn't work for some reason, let us know on the mailing list and somebody can fix it.) But... I'm rather surprised that

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
On 19/07/2017 18:42, Steven D'Aprano wrote: 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 me

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Steven D'Aprano
On Wed, Jul 19, 2017 at 06:08:57PM +0200, Sydney Shall wrote: > For the second error, regarding 'nan' finding 'nan', I received the > following output. > > FAIL: test_nan_in_capitalsadvanced (__main__.TestPOC) > -- > Traceback (

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Steven D'Aprano
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:

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
On 19/07/2017 18:05, Alan Gauld via Tutor wrote: 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 functi

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
On 19/07/2017 17:43, Peter Otten wrote: Sydney Shall wrote: I am learning to use unittest. I have written a program that runs as it should. 247 tests give me a satisfactory answer. I have now added one more test and I get an error which I do not understand. The two relevant tests are: de

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Alan Gauld via Tutor
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(

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Peter Otten
Sydney Shall wrote: > I am learning to use unittest. > > I have written a program that runs as it should. > 247 tests give me a satisfactory answer. > > I have now added one more test and I get an error which I do not > understand. > > The two relevant tests are: > > def test_type_capitalsad

[Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
I am learning to use unittest. I have written a program that runs as it should. 247 tests give me a satisfactory answer. I have now added one more test and I get an error which I do not understand. The two relevant tests are: def test_type_capitalsadvanced(self): self.assertEqual(type