Re: [Tutor] TDD: How to test input()?

2016-10-08 Thread Alan Gauld via Tutor
On 08/10/16 07:18, Steven D'Aprano wrote: > Testing code that depends on user input is always tricky. There are a > few ways to deal with it: > > (5) Or you could manually monkey-patch sys.stdin as you do. A variation on this that I have used is to read the input from stdin as usual but

Re: [Tutor] TDD: How to test input()?

2016-10-08 Thread Steven D'Aprano
On Fri, Oct 07, 2016 at 08:26:28PM -0500, boB Stepp wrote: > I think I have this figured out, but I want to be certain I am doing > it both correctly and in the preferred way. I have a need for a > get_input() function and have written my first test for this function > as follows: Testing code

Re: [Tutor] TDD: How to test input()?

2016-10-07 Thread boB Stepp
Oops! On Fri, Oct 7, 2016 at 8:26 PM, boB Stepp wrote: > I think I have this figured out, but I want to be certain I am doing > it both correctly and in the preferred way. I have a need for a > get_input() function and have written my first test for this function > as

[Tutor] TDD: How to test input()?

2016-10-07 Thread boB Stepp
I think I have this figured out, but I want to be certain I am doing it both correctly and in the preferred way. I have a need for a get_input() function and have written my first test for this function as follows: class TestGetInput(unittest.TestCase): '''Tests for the function