[test] fix text_to_dict doctest (closes #174440)

authorDavid Douard <david.douard@logilab.fr>
changeset4085cf1c6908
branchdefault
phasedraft
hiddenyes
parent revision#15cc58055d93 [optik_ext] Merge textutils imports
child revision#adf1a1829274 [graph] More explicit error message if dot is not found/executable (closes #253516), #dee2a57e9eb7 [graph] More explicit error message if dot is not found/executable (closes #253516), #0cf64ae59c21 [graph] More explicit error message if dot is not found/executable (closes #253516)
files modified by this revision
textutils.py
# HG changeset patch
# User David Douard <david.douard@logilab.fr>
# Date 1409567098 -7200
# Mon Sep 01 12:24:58 2014 +0200
# Node ID 4085cf1c6908a87efd83c0b503fd8f3f3c0ef163
# Parent 15cc58055d934a96af6ee8fe527f09c698f97593
[test] fix text_to_dict doctest (closes #174440)

diff --git a/textutils.py b/textutils.py
@@ -282,15 +282,18 @@
1  def text_to_dict(text):
2      """parse multilines text containing simple 'key=value' lines and return a
3      dict of {'key': 'value'}. When the same key is encountered multiple time,
4      value is turned into a list containing all values.
5 
6 -    >>> text_to_dict('''multiple=1
7 +    >>> d = text_to_dict('''multiple=1
8      ... multiple= 2
9      ... single =3
10      ... ''')
11 -    {'single': '3', 'multiple': ['1', '2']}
12 +    >>> d['single']
13 +    '3'
14 +    >>> d['multiple']
15 +    ['1', '2']
16 
17      """
18      res = {}
19      if not text:
20          return res