Last change
on this file since 29 was
29,
checked in by landauf, 17 years ago
|
updated boost from 1_33_1 to 1_34_1
|
File size:
1.1 KB
|
Rev | Line | |
---|
[29] | 1 | # Copyright Niall Douglas 2005. |
---|
| 2 | # Distributed under the Boost Software License, Version 1.0. |
---|
| 3 | # (See accompanying file LICENSE_1_0.txt or copy at |
---|
| 4 | # http://www.boost.org/LICENSE_1_0.txt) |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | """ |
---|
| 8 | >>> from voidptr_ext import * |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | Check for correct conversion |
---|
| 12 | |
---|
| 13 | >>> use(get()) |
---|
| 14 | |
---|
| 15 | Check that None is converted to a NULL void pointer |
---|
| 16 | |
---|
| 17 | >>> useany(get()) |
---|
| 18 | 1 |
---|
| 19 | >>> useany(None) |
---|
| 20 | 0 |
---|
| 21 | |
---|
| 22 | Check that we don't lose type information by converting NULL |
---|
| 23 | opaque pointers to None |
---|
| 24 | |
---|
| 25 | >>> assert getnull() is None |
---|
| 26 | >>> useany(getnull()) |
---|
| 27 | 0 |
---|
| 28 | |
---|
| 29 | Check that there is no conversion from integers ... |
---|
| 30 | |
---|
| 31 | >>> try: use(0) |
---|
| 32 | ... except TypeError: pass |
---|
| 33 | ... else: print 'expected a TypeError' |
---|
| 34 | |
---|
| 35 | ... and from strings to opaque objects |
---|
| 36 | |
---|
| 37 | >>> try: use("") |
---|
| 38 | ... except TypeError: pass |
---|
| 39 | ... else: print 'expected a TypeError' |
---|
| 40 | """ |
---|
| 41 | def run(args = None): |
---|
| 42 | import sys |
---|
| 43 | import doctest |
---|
| 44 | |
---|
| 45 | if args is not None: |
---|
| 46 | sys.argv = args |
---|
| 47 | return doctest.testmod(sys.modules.get(__name__)) |
---|
| 48 | |
---|
| 49 | if __name__ == '__main__': |
---|
| 50 | print "running..." |
---|
| 51 | import sys |
---|
| 52 | status = run()[0] |
---|
| 53 | if (status == 0): print "Done." |
---|
| 54 | sys.exit(status) |
---|
Note: See
TracBrowser
for help on using the repository browser.