Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42409
| From | Roy Smith <roy@panix.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Help with python code! |
| Date | 2013-03-31 17:08 -0400 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <roy-72EC60.17080931032013@news.panix.com> (permalink) |
| References | <37f23623-8bf5-421a-ab6a-34ff622c69f1@googlegroups.com> |
In article <37f23623-8bf5-421a-ab6a-34ff622c69f1@googlegroups.com>, jojo <gerrymcgovern@gmail.com> wrote: > Hi - I am a newbie to python and was wondering can someone tell me what the > following code does. I need to figure out how to test it I know this is going to sound unhelpful, but if your task is to test the code, what good does it do to know what it does? Clearly, it does what it does. What you really want to know is "What is it *supposed* to do?" Until you know what it's supposed to do, it is meaningless to even think about testing it. Seriously. I'm not trying to make life difficult for you. I've seen too much time and effort wasted on useless testing because there wasn't any specification for what the code was supposed to do. I will give you one hint, however. You've got stuff like: for line in os.popen(cmd).readlines(): line = line.rstrip() This is a syntax error because the indenting is wrong. Unlike C#, indenting is significant in Python. I don't know if the code you've got really is indented wrong, or it's just an artifact of how you posted it. But before anything else, you need to sort that out. Unless, of course, the specification for this code is, "It is supposed to raise IndentationError", in which case it passes the test :-)
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Help with python code! jojo <gerrymcgovern@gmail.com> - 2013-03-31 13:10 -0700
Re: Help with python code! Chris Angelico <rosuav@gmail.com> - 2013-04-01 07:39 +1100
Re: Help with python code! jojo <gerrymcgovern@gmail.com> - 2013-03-31 14:06 -0700
Re: Help with python code! Roy Smith <roy@panix.com> - 2013-03-31 17:13 -0400
Re: Help with python code! jojo <gerrymcgovern@gmail.com> - 2013-03-31 14:21 -0700
Re: Help with python code! Roy Smith <roy@panix.com> - 2013-03-31 17:27 -0400
Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:32 -0700
Re: Help with python code! Alister <alister.ware@ntlworld.com> - 2013-04-01 17:54 +0000
Re: Help with python code! rurpy@yahoo.com - 2013-03-31 14:46 -0700
Re: Help with python code! Chris Angelico <rosuav@gmail.com> - 2013-04-01 08:35 +1100
Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:41 -0700
Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:41 -0700
Re: Help with python code! Jason Friedman <jsf80238@gmail.com> - 2013-04-02 21:59 -0600
Re: Help with python code! Chris Angelico <rosuav@gmail.com> - 2013-04-01 08:21 +1100
Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:24 -0700
Re: Help with python code! gerrymcgovern@gmail.com - 2013-03-31 14:24 -0700
Re: Help with python code! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-31 23:02 +0100
Re: Help with python code! Chris Angelico <rosuav@gmail.com> - 2013-04-01 09:04 +1100
Re: Help with python code! jojo <gerrymcgovern@gmail.com> - 2013-03-31 14:06 -0700
Re: Help with python code! Roy Smith <roy@panix.com> - 2013-03-31 17:08 -0400
csiph-web