• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)
4from __future__ import print_function
5"""
6>>> from tuple_ext import *
7>>> def printer(*args):
8...     for x in args: print(x,)
9...     print('')
10...
11>>> print(convert_to_tuple("this is a test string"))
12('t', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 't', 'e', 's', 't', ' ', 's', 't', 'r', 'i', 'n', 'g')
13>>> t1 = convert_to_tuple("this is")
14>>> t2 = (1,2,3,4)
15>>> test_operators(t1,t2,printer) #doctest: +NORMALIZE_WHITESPACE
16('t', 'h', 'i', 's', ' ', 'i', 's', 1, 2, 3, 4)
17>>> make_tuple()
18()
19>>> make_tuple(42)
20(42,)
21>>> make_tuple('hello', 42)
22('hello', 42)
23"""
24
25def run(args = None):
26    import sys
27    import doctest
28
29    if args is not None:
30        sys.argv = args
31    return doctest.testmod(sys.modules.get(__name__))
32
33if __name__ == '__main__':
34    print("running...")
35    import sys
36    status = run()[0]
37    if (status == 0): print("Done.")
38    sys.exit(status)
39