Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Testing First Steps With Testing Writing and Running Doctests

Eric Schroeder
Eric Schroeder
19,894 Points

Question about 'get_moves' test

In the test for get_moves, the player position that is passed into the function is (0, 2). On a 2 by 2 board that position is off the board. It passes the logic of the function but would never happen in the game. Is it important to write a test that fits within the constraints of the entire program or should you concentrate on just the logic of the function itself?

3 Answers

Ryan S
Ryan S
27,276 Points

Hey Eric,

That is a really good catch. I certainly missed that when I originally went through that video. I'm not even sure if it passes the logic of the function because the intention was to place the player in the corner (8:00 in the video), however if that were actually the case, then the player should not have both 'UP' and 'DOWN' as possible moves, yet that is what is returned. Also, a corner position should only return 2 possible moves, not 3. I think you just uncovered an error.