Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/test/dict.py @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.0 KB
Line 
1# Copyright David Abrahams 2004. Distributed under the Boost
2# Software License, Version 1.0. (See accompanying
3# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4"""
5>>> from dict_ext import *
6>>> def printer(*args):
7...     for x in args: print x,
8...     print
9...
10>>> print new_dict()
11{}
12>>> print data_dict()
13{1: {'key2': 'value2'}, 'key1': 'value1'}
14>>> tmp = data_dict()
15>>> print dict_keys(tmp)
16[1, 'key1']
17>>> print dict_values(tmp)
18[{'key2': 'value2'}, 'value1']
19>>> print dict_items(tmp)
20[(1, {'key2': 'value2'}), ('key1', 'value1')]
21>>> print dict_from_sequence([(1,1),(2,2),(3,3)])
22{1: 1, 2: 2, 3: 3}
23>>> test_templates(printer)
24a test string
2513
26None
27{1.5: 13, 1: 'a test string'}
28default
29default
30"""
31
32def run(args = None):
33    import sys
34    import doctest
35
36    if args is not None:
37        sys.argv = args
38    return doctest.testmod(sys.modules.get(__name__))
39   
40if __name__ == '__main__':
41    print "running..."
42    import sys
43    status = run()[0]
44    if (status == 0): print "Done."
45    sys.exit(status)
Note: See TracBrowser for help on using the repository browser.