> 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
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
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
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
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
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
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_
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
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
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:
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
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
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
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 (
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:
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
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
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
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(
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
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
21 matches
Mail list logo