Re: [Tutor] Problems with pytz module

2017-07-19 Thread Mats Wichmann
> On 19/07/17 20:58, Daniel Bosah wrote: don't see a lot of benefit to using pytz here... just my opinion. the question does give a chance to annotate the example with some thoughts, though; take them for what they're worth. import datetime import pytz class Account: """Simple account class

Re: [Tutor] Problems with pytz module

2017-07-19 Thread Alan Gauld via Tutor
On 19/07/17 20:58, Daniel Bosah wrote: > class Account: > def deposit(self,amount): > if amount > 0: > self.balance += amount > self.show_balance() > > self.transaction_list.append( > def withdrawl(self,amount): > if 0 < amount <= self.balance

Re: [Tutor] Problems with pytz module

2017-07-19 Thread Peter Otten
Daniel Bosah wrote: > I'm learning about OOP programming in Python. > This is my code from my online course. > > import datetime > import pytz > class Account: > """Simple account class with balance""" Why so many "s ? Use either one for single-line strings "Simple account class wit

Re: [Tutor] Problems with pytz module

2017-07-19 Thread Peter Otten
Daniel Bosah wrote: > I'm learning about OOP programming in Python. > This is my code from my online course. > > import datetime > import pytz > class Account: > """Simple account class with balance""" Why so many "s ? Use either one for single-line strings "Simple account class wit

Re: [Tutor] centos 7 - new setup.. weird python!

2017-07-19 Thread Zachary Ware
On Wed, Jul 19, 2017 at 3:48 PM, bruce wrote: > Hi. Hi Bruce, > > Testing setting up a new Cnntos7 instance. > > I ran python -v from the cmdline... and instantly got a bunch of the > following! Pretty sure this isn't correct. > > Anyone able to give pointers as to what I've missed. > > thanks

Re: [Tutor] centos 7 - new setup.. weird python!

2017-07-19 Thread Mats Wichmann
On 07/19/2017 02:48 PM, bruce wrote: > Hi. > > Testing setting up a new Cnntos7 instance. > > I ran python -v from the cmdline... and instantly got a bunch of the > following! Pretty sure this isn't correct. > > Anyone able to give pointers as to what I've missed. It is expected, actually. You

[Tutor] Problems with pytz module

2017-07-19 Thread Daniel Bosah
I'm learning about OOP programming in Python. This is my code from my online course. import datetime import pytz class Account: """Simple account class with balance""" def __init__(self,name,balance): self.name = name self.balance = balance self.transaction_

[Tutor] centos 7 - new setup.. weird python!

2017-07-19 Thread bruce
Hi. Testing setting up a new Cnntos7 instance. I ran python -v from the cmdline... and instantly got a bunch of the following! Pretty sure this isn't correct. Anyone able to give pointers as to what I've missed. thanks python -v # installing zipimport hook import zipimport # builtin # install

Re: [Tutor] unittest difficulty

2017-07-19 Thread Japhy Bartlett
Is `0.0` the troublesome float here? On Wed, Jul 19, 2017 at 7:35 AM, Shall, Sydney 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 > un

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

[Tutor] unittest difficulty

2017-07-19 Thread Shall, Sydney
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

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