An example using only Unix style options:
+.. doctest::
+
>>> import getopt
>>> args = '-a -b -cfoo -d bar a1 a2'.split()
>>> args
Using long option names is equally easy:
+.. doctest::
+
>>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'
>>> args = s.split()
>>> args
>>> args
['a1', 'a2']
-In a script, typical usage is something like this::
+In a script, typical usage is something like this:
+
+.. testcode::
import getopt, sys
main()
Note that an equivalent command line interface could be produced with less code
-and more informative help and error messages by using the :mod:`argparse` module::
+and more informative help and error messages by using the :mod:`argparse` module:
+
+.. testcode::
import argparse