Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 157 Online
OpenStudy (anonymous):

Hi, I'm a bit confused by the ps3 testing. My first function works fine, and running test_get_word_score on its own marks it successful. However, if you run test_ps3a.py as a whole as suggested, it fails the function and displays different scores from the ones generated by running either the function or the test function separately. Using test_ps3a.py, the bonus points stop working properly, and more importantly the test function claims it gets 'None' values returned for every test. However, this is not the case when I use the test function in isolation, or test my function myself.

OpenStudy (anonymous):

Turns out the exact same thing happens with part 2. It works if you run the test function separately, but if I run test_ps3a.py the functions then claim to get 'None' returns. Are we supposed to be testing with the test_ file at all? Baffled.

OpenStudy (anonymous):

which course? 2008, 2011 OCW or 2013 Edx?? word game? scrabble? read thru test_ps3a and see what it is expecting. if it is complaining about your function returning None, are you returning something? The Bonus points are calculated based on the size of the hand - did you hard code the hand size??

OpenStudy (anonymous):

Sorry, I assumed this group was tied to a version of the course. I was talking about 2011 OCW, and the pseudo-scrabble problem in problem set 3, part A. Thanks for your suggestions, which are the right way to start debugging an issue like this. As it happens though, today everything's working fine, despite not changing the program yet. For posterity: somehow, yesterday I'd ended up running both py files in a single IDLE window. I reckon I closed the ps3a.py file's window by accident - testps3a's window would still run functions from both because it includes ps3a, but it looks like testps3a was getting very confused. So... I recommend not doing that.

OpenStudy (anonymous):

after editing code in the editing window, F5 will restart the shell (window) with the current code. When the shell starts, it 'has' the current state of the code - when you edit things, if you don't restart the shell it won't know about the changes.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!