diff -r 3d328ee18612 Doc/library/configparser.rst
--- a/Doc/library/configparser.rst Mon Jan 30 13:56:20 2017 +0300
+++ b/Doc/library/configparser.rst Mon Jan 30 14:06:28 2017 +0100
@@ -42,6 +42,11 @@
be used for this purpose.
+.. testsetup::
+
+ import configparser
+
+
Quick Start
-----------
@@ -95,7 +100,6 @@
.. doctest::
- >>> import configparser
>>> config = configparser.ConfigParser()
>>> config.sections()
[]
@@ -116,13 +120,13 @@
'no'
>>> topsecret['Port']
'50022'
- >>> for key in config['bitbucket.org']: print(key)
- ...
+ >>> for key in sorted(config['bitbucket.org']):
+ ... print(key)
+ compression
+ compressionlevel
+ forwardx11
+ serveraliveinterval
user
- compressionlevel
- serveraliveinterval
- compression
- forwardx11
>>> config['bitbucket.org']['ForwardX11']
'yes'
@@ -469,10 +473,10 @@
... 'bar': 'y',
... 'baz': 'z'}
... })
- >>> parser.sections()
- ['section3', 'section2', 'section1']
- >>> [option for option in parser['section3']]
- ['baz', 'foo', 'bar']
+ >>> sorted(parser.sections())
+ ['section1', 'section2', 'section3']
+ >>> sorted(option for option in parser['section3'])
+ ['bar', 'baz', 'foo']
In these operations you need to use an ordered dictionary as well:
@@ -498,11 +502,11 @@
... ),
... ))
... )
- >>> parser.sections()
+ >>> sorted(parser.sections())
['s1', 's2']
- >>> [option for option in parser['s1']]
+ >>> sorted([option for option in parser['s1']])
['1', '3', '5']
- >>> [option for option in parser['s2'].values()]
+ >>> sorted([option for option in parser['s2'].values()])
['b', 'd', 'f']
* *allow_no_value*, default value: ``False``
@@ -597,11 +601,11 @@
... line #3
... """)
>>> print(parser['hashes']['shebang'])
-
+