Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread boB Stepp
On Sat, Sep 24, 2016 at 11:05 PM, Steven D'Aprano wrote: > On Sat, Sep 24, 2016 at 12:55:28AM -0500, boB Stepp wrote: >> def right_justify(a_string): >> '''This fucntion will take the string, "a_string", and left justify it by > > Left justify? Oops! Typo. [snip] > def test_random_str

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread Steven D'Aprano
On Sat, Sep 24, 2016 at 12:55:28AM -0500, boB Stepp wrote: > "Write a function named right_justify that takes a string named s as a > parameter and prints the string with enough leading spaces so that the > last letter of the string is in column 70 of the display. Hint: Use > concatenation and r

Re: [Tutor] Basic telnet question solved

2016-09-24 Thread Phil
On 25/09/16 07:17, David Rock wrote: header = tn.read_until("character is '^]’.”, timeout=5) print(header) Thank you David, read_until() led me to a result. It seems that the telnetlib doesn't emulate the console telnet command exactly, so I didn't get the connection response that I had expec

Re: [Tutor] Basic telnet question

2016-09-24 Thread David Rock
> On Sep 24, 2016, at 15:49, Phil wrote: > > On 25/09/16 01:01, David Rock wrote: >> >> when you say "the client is not responding, certainly not as expected”, >> what, exactly, is the output you get? >> > > In my dazed state I think I responded to David personally instead of the > list, my

Re: [Tutor] Basic telnet question

2016-09-24 Thread Phil
On 25/09/16 01:01, David Rock wrote: On Sep 24, 2016, at 04:21, Phil wrote: The problem is that the client is not responding, certainly not as expected. There aren't any Python errors either, however, the console is blocked until the client is disabled. If I then attempt a connection with t

Re: [Tutor] Basic telnet question

2016-09-24 Thread Phil
On 24/09/16 21:03, Joaquin Alzola wrote: $ telnet localhost 7356 The client then responds with: Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. Why not use the socket module? I did try the socket module, Joaquin but it didn't seem to be leading anywhere plus the

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread boB Stepp
On Sat, Sep 24, 2016 at 2:04 AM, Ben Finney wrote: > Bob, you may want to also subscribe to the specific forum for testing in > Python http://lists.idyll.org/listinfo/testing-in-python>. You're > beyond the beginner material that's usually discussed on this Tutor forum. Honestly, Ben, I thought t

Re: [Tutor] Basic telnet question

2016-09-24 Thread David Rock
> On Sep 24, 2016, at 04:21, Phil wrote: > > The problem is that the client is not responding, certainly not as expected. > There aren't any Python errors either, however, the console is blocked until > the client is disabled. If I then attempt a connection with the disabled > client a Python

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread Walter Prins
Hi, On 24 September 2016 at 06:55, boB Stepp wrote: > > def test_returned_len_is_70(self): > '''Check that the string returned by "right_justify(a_string)" is the > length of the entire line, i.e., 70 columns.''' > > for test_string in self.test_strings: >

[Tutor] Basic telnet question

2016-09-24 Thread Phil
Thank you for reading this. If I enter the following at the prompt: $ telnet localhost 7356 The client then responds with: Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. I'd like to do the same from Python. My code is as follows: import telnetlib tn = telnetlib.Telnet

Re: [Tutor] Questions as to how to run the same unit test multiple times on varying input data.

2016-09-24 Thread Ben Finney
Bob, you may want to also subscribe to the specific forum for testing in Python http://lists.idyll.org/listinfo/testing-in-python>. You're beyond the beginner material that's usually discussed on this Tutor forum. boB Stepp writes: > What I struggled with was getting tests to run for ALL of the