annotate tests/simpleexample.py @ 12:e0a3148e67a8

bug fix and a short overhaul of documentation
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 28 Jan 2013 19:54:36 -0800
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 class Foo(object):
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 """silly class that does nothing"""
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 def __init__(self): pass
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 def foo(self, value):
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 print "The value is %s" % value
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 def bar(self, fleem, verbose=False):
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 """
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 The good ole `bar` command
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 - fleem: you know, that thing fleem
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 - verbose: whether to print out more things or not
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 """
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 if verbose:
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 print "You gave fleem=%s" % fleem
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 return fleem * 2
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 import commandparser
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 parser = commandparser.CommandParser(Foo)
e0a3148e67a8 bug fix and a short overhaul of documentation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 parser.invoke()