File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ exception:
9797
9898An example using only Unix style options:
9999
100+ .. doctest ::
101+
100102 >>> import getopt
101103 >>> args = ' -a -b -cfoo -d bar a1 a2' .split()
102104 >>> args
@@ -109,6 +111,8 @@ An example using only Unix style options:
109111
110112Using long option names is equally easy:
111113
114+ .. doctest ::
115+
112116 >>> s = ' --condition=foo --testing --output-file abc.def -x a1 a2'
113117 >>> args = s.split()
114118 >>> args
@@ -120,7 +124,9 @@ Using long option names is equally easy:
120124 >>> args
121125 ['a1', 'a2']
122126
123- In a script, typical usage is something like this::
127+ In a script, typical usage is something like this:
128+
129+ .. testcode ::
124130
125131 import getopt, sys
126132
@@ -150,7 +156,9 @@ In a script, typical usage is something like this::
150156 main()
151157
152158Note that an equivalent command line interface could be produced with less code
153- and more informative help and error messages by using the :mod: `argparse ` module::
159+ and more informative help and error messages by using the :mod: `argparse ` module:
160+
161+ .. testcode ::
154162
155163 import argparse
156164
You can’t perform that action at this time.
0 commit comments