Python Koans is available through git on Github:
It is also mirrored on bitbucet for Mercurial users :
-From a *nix terminal or windows command prompt go to the python koans\python_<b>VERSION</b> folder and run:
+From a *nix terminal or windows command prompt go to the python koans\python_<b>VERSION</b> folder and run:
In my case I'm using Python 3 with windows, so I fire up my command shell (cmd.exe) and run this:
- C:\>cd "c:\hg\python_koans\python3"
- C:\hg\python_koans\python3>python contemplate_koans.py
- test_assert_truth has damaged your karma.
+.. image:: http://i442.photobucket.com/albums/qq150/gregmalcolm/GettingStarted.png
- You have not yet reached enlightenment ...
- AssertionError: False is not True
+Apparently a test failed::
- Please meditate on the following code:
- File "C:\hg\python_koans\python3\koans\about_asserts.py", line 12, in test_
- self.assertTrue(False) # This should be true
- Beautiful is better than ugly.
-Apparently a test failed:
AssertionError: False is not True
It also tells me exactly where the problem in, its an assert on line 12 of .\koans\about_asserts.py. This one is easy, just change False to True to make the test pass.
-Sooner or later you will likely encounter tests where you are not sure what the expected value should be. For example:
+Sooner or later you will likely encounter tests where you are not sure what the expected value should be. For example:
This is where the Python Command Line can come in handy. in this case I can fire up the command line, recreate the scenario and run queries:
- Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on
- Type "help", "copyright", "credits" or "license" for more information.
- >>> isinstance(fido, object)
+.. image:: http://i442.photobucket.com/albums/qq150/gregmalcolm/DebuggingPython.png
Getting the Most From the Koans