Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Testing First Steps With Testing Writing and Running Doctests

Eric Schroeder
Eric Schroeder
19,882 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.