]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/python/test/tuple.py
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / python / test / tuple.py
CommitLineData
7c673cae
FG
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)
7c673cae
FG
4"""
5>>> from tuple_ext import *
6>>> def printer(*args):
7... for x in args: print(x,)
8... print('')
9...
10>>> print(convert_to_tuple("this is a test string"))
11('t', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 't', 'e', 's', 't', ' ', 's', 't', 'r', 'i', 'n', 'g')
12>>> t1 = convert_to_tuple("this is")
13>>> t2 = (1,2,3,4)
14>>> test_operators(t1,t2,printer) #doctest: +NORMALIZE_WHITESPACE
15('t', 'h', 'i', 's', ' ', 'i', 's', 1, 2, 3, 4)
16>>> make_tuple()
17()
18>>> make_tuple(42)
19(42,)
20>>> make_tuple('hello', 42)
21('hello', 42)
22"""
23
20effc67
TL
24from __future__ import print_function
25
7c673cae
FG
26def run(args = None):
27 import sys
28 import doctest
29
30 if args is not None:
31 sys.argv = args
32 return doctest.testmod(sys.modules.get(__name__))
20effc67 33
7c673cae
FG
34if __name__ == '__main__':
35 print("running...")
36 import sys
37 status = run()[0]
38 if (status == 0): print("Done.")
39 sys.exit(status)