cctool

A tool for managing contacts and calendars.
git clone https://git.ce9e.org/cctool.git

commit
feb01dbadfb8ab833e10dac7ba36021cceb64775
parent
89c2b50baf6768fc9466e8e13e8f644d2281aefc
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2015-04-11 07:35
add some multidict doctests

Diffstat

M cctool.py 14 ++++++++++----

1 files changed, 10 insertions, 4 deletions


diff --git a/cctool.py b/cctool.py

@@ -90,13 +90,19 @@ class MultiDict(OrderedDict):
   90    90 	>>> d['foo'] = []
   91    91 	>>> 'foo' in d
   92    92 	False
   93    -1 	>>> d['foo'] = [1, 2, 3]
   -1    93 	>>> d['foo'] = ['a', 'b', 'c']
   94    94 	>>> 'foo' in d
   95    95 	True
   96    96 	>>> d['foo']
   97    -1 	[1, 2, 3]
   -1    97 	['a', 'b', 'c']
   98    98 	>>> d.first('foo')
   99    -1 	1
   -1    99 	'a'
   -1   100 	>>> d.join('foo')
   -1   101 	'a,b,c'
   -1   102 	>>> d.join('foo', sep=', ')
   -1   103 	'a, b, c'
   -1   104 	>>> d.join('bar', default='N/A')
   -1   105 	'N/A'
  100   106 	"""
  101   107 
  102   108 	def __contains__(self, key):
@@ -117,7 +123,7 @@ class MultiDict(OrderedDict):
  117   123 		else:
  118   124 			raise KeyError(key)
  119   125 
  120    -1 	def join(self, key, default='', sep=u','):
   -1   126 	def join(self, key, default='', sep=','):
  121   127 		if key in self:
  122   128 			if len(self[key]) == 1:
  123   129 				return self[key][0]