On Mon, 10 Mar 2014 17:57:19 +0100, Peter Otten wrote:
> Steven D'Aprano wrote:
>> what are my options for *automatically* supplying input to raw_input?
>
> https://pypi.python.org/pypi/mock
>
> In Python 3 this is part of the standard library:
Nice!
Thanks to everyone who responded.
--
Steven D'Aprano writes:
> Does anyone have any good hints for testing interactive code that uses
> raw_input, or input in Python 3?
Are you testing the behaviour of the ‘input’ function?
If not, then it is an external dependency; and, since you're not
interested in testing its behaviour, you c
On 03/10/2014 08:59 AM, Steven D'Aprano wrote:
With an
automated test, I can provide the arguments, and check the result, but
what are my options for *automatically* supplying input to raw_input?
pexpect?
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
> Does anyone have any good hints for testing interactive code that uses
> raw_input, or input in Python 3?
>
> A simple technique would be to factor out the interactive part, e.g. like
> this:
>
> # Before
> def spam():
> answer = raw_input(prompt)
> return eggs(a
On 10 March 2014 15:59, Steven D'Aprano
wrote:
> Does anyone have any good hints for testing interactive code that uses
> raw_input, or input in Python 3?
>
> A simple technique would be to factor out the interactive part, e.g. like
> this:
>
> # Before
> def spam():
> answer = raw_input(promp
Does anyone have any good hints for testing interactive code that uses
raw_input, or input in Python 3?
A simple technique would be to factor out the interactive part, e.g. like
this:
# Before
def spam():
answer = raw_input(prompt)
return eggs(answer) + cheese(answer) + toast(answer)
#