testing-debugging/script.rst
changeset 521 88a01948450d
parent 488 85f049b5ec08
--- a/testing-debugging/script.rst	Wed Nov 17 23:24:23 2010 +0530
+++ b/testing-debugging/script.rst	Wed Nov 17 23:24:57 2010 +0530
@@ -68,7 +68,7 @@
   if __name__ == '__main__':
       result = gcd(48, 64)
       if result != 16:
-          print "Test failed for the case a=48 and b=64. Expected 16. Obtained %d instead." % result
+          print "Test failed"
       print "Test Passed"
           
 Note that we have introduced a new semantic which uses two new magic names
@@ -173,15 +173,15 @@
      1.Four Space Indentation
      2.Limit to 79 characters a line, but readability should come first.
      3.Functions and methods should be separated with two blank lines. 
-       Class definitions with three blank lines. 
      4.No inline comments, comments should be above the line they comment.
      5.Use Docstring to explain units of code performing specific task like
      	functions.
      6.We should always have whitespace around operators and after punctuation. 
 
 %% %% Pause and do the following exercise
-%% %% Give meaningful names to the variables in the gcd code .     
-
+%% %% Give meaningful names to the variables in following
+code
+	c=a/b
 
 
 This will help enormously towards making our program more readable.
@@ -217,10 +217,10 @@
 
 Lets see why and how we can use Exception in our programs.
 
-{{{ Slide with code snippet }}}
+
 
 Type on your interpreter::
-     
+
      a = raw_input("Enter a number:")
      num = int(a) 
 
@@ -258,7 +258,7 @@
 Test if it is correct by changing the code. And refine the hypothesis 
 on the basis of our result.
 
-{{{ Slide with code snippet }}}
+
 
 Lets see another example of debugging. Create a file mymodule.py and
 add the following code::
@@ -267,13 +267,16 @@
 	total=1+1	
 	print spam
 
-{{{ Slide with code snippet }}} 
+
 
 Lets now try and run this code ::
      
      import mymodule 
      mymodule.test()
 
+
+{{{ Slide with idb and total being accessed }}}
+
 Interpreter gives us an error because spam is not defined 
 but lets now do %debug on ipython interpreter. The prompt on the shell has changed to ipdb. This is debugger here you can access variables in that code block for example 'total'unlike the normal interpreter.