Re: [Tutor] how to unittest cli input

2015-10-10 Thread Cameron Simpson
On 10Oct2015 17:41, Alex Kleider wrote: I'm trying to follow a test driven development paradigm (using unittest) but can't figure out how to test functions that collect info from the command line such as the following. Aside: I'd say "the standard input" , not "the command line"; to me the lat

Re: [Tutor] how to unittest cli input

2015-10-10 Thread Ben Finney
Alex Kleider writes: > """ > I'm trying to follow a test driven development paradigm (using > unittest) but can't figure out how to test functions that collect > info from the command line such as the following. > """ > # collect.py > def collect_data(): > ret = {} > ret['first'] = input(

[Tutor] how to unittest cli input

2015-10-10 Thread Alex Kleider
""" I'm trying to follow a test driven development paradigm (using unittest) but can't figure out how to test functions that collect info from the command line such as the following. """ # collect.py def collect_data(): ret = {} ret['first'] = input("Enter your first name: ") ret['last

Re: [Tutor] FrozenDict

2015-10-10 Thread Alexandre Chabot-Leclerc
> Aha, that's useful to know. So it's a no-no to subclass *any* builtin? I don't think it's a no-no, I just think it comes with a few problems that are solved if you subclass the classes that are *meant* to be subclassed, like UserDict, UserList, or UserString. > I checked collections.UserDict

Re: [Tutor] FrozenDict

2015-10-10 Thread Albert-Jan Roskam
> Date: Fri, 9 Oct 2015 01:14:05 -0500 > From: eryk...@gmail.com > To: tutor@python.org > Subject: Re: [Tutor] FrozenDict > > On 10/8/15, Steven D'Aprano wrote: >> >> That's one solution, but it is certainly possible for the class to be >> its own iterato

Re: [Tutor] FrozenDict

2015-10-10 Thread Albert-Jan Roskam
> Date: Thu, 8 Oct 2015 11:47:41 +1100 > From: st...@pearwood.info > To: tutor@python.org > Subject: Re: [Tutor] FrozenDict > > On Wed, Oct 07, 2015 at 04:10:20PM +, Albert-Jan Roskam wrote: >> Hi, >> I wanted to create a read-only dict to hold some con

Re: [Tutor] FrozenDict

2015-10-10 Thread Albert-Jan Roskam
> From: a...@alexchabot.net > To: tutor@python.org > Date: Wed, 7 Oct 2015 18:54:42 +0200 > Subject: Re: [Tutor] FrozenDict > > Hi Albert-Jan, > As far as I know, the recommended object to subclass when subclassing a > `dict` is `UserDict`. In Python 3, it'