|
Last change
on this file since 47 was
29,
checked in by landauf, 17 years ago
|
|
updated boost from 1_33_1 to 1_34_1
|
|
File size:
1.1 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 enum_ext import * |
|---|
| 6 | |
|---|
| 7 | >>> identity(color.red) |
|---|
| 8 | enum_ext.color.red |
|---|
| 9 | |
|---|
| 10 | >>> identity(color.green) |
|---|
| 11 | enum_ext.color.green |
|---|
| 12 | |
|---|
| 13 | >>> identity(color.blue) |
|---|
| 14 | enum_ext.color.blue |
|---|
| 15 | |
|---|
| 16 | >>> identity(color(1)) |
|---|
| 17 | enum_ext.color.red |
|---|
| 18 | |
|---|
| 19 | >>> identity(color(2)) |
|---|
| 20 | enum_ext.color.green |
|---|
| 21 | |
|---|
| 22 | >>> identity(color(3)) |
|---|
| 23 | enum_ext.color(3) |
|---|
| 24 | |
|---|
| 25 | >>> identity(color(4)) |
|---|
| 26 | enum_ext.color.blue |
|---|
| 27 | |
|---|
| 28 | --- check export to scope --- |
|---|
| 29 | |
|---|
| 30 | >>> identity(red) |
|---|
| 31 | enum_ext.color.red |
|---|
| 32 | |
|---|
| 33 | >>> identity(green) |
|---|
| 34 | enum_ext.color.green |
|---|
| 35 | |
|---|
| 36 | >>> identity(blue) |
|---|
| 37 | enum_ext.color.blue |
|---|
| 38 | |
|---|
| 39 | >>> try: identity(1) |
|---|
| 40 | ... except TypeError: pass |
|---|
| 41 | ... else: print 'expected a TypeError' |
|---|
| 42 | |
|---|
| 43 | >>> c = colorized() |
|---|
| 44 | >>> c.x |
|---|
| 45 | enum_ext.color.red |
|---|
| 46 | >>> c.x = green |
|---|
| 47 | >>> c.x |
|---|
| 48 | enum_ext.color.green |
|---|
| 49 | ''' |
|---|
| 50 | |
|---|
| 51 | def run(args = None): |
|---|
| 52 | import sys |
|---|
| 53 | import doctest |
|---|
| 54 | |
|---|
| 55 | if args is not None: |
|---|
| 56 | sys.argv = args |
|---|
| 57 | return doctest.testmod(sys.modules.get(__name__)) |
|---|
| 58 | |
|---|
| 59 | if __name__ == '__main__': |
|---|
| 60 | print "running..." |
|---|
| 61 | import sys |
|---|
| 62 | status = run()[0] |
|---|
| 63 | if (status == 0): print "Done." |
|---|
| 64 | sys.exit(status) |
|---|
Note: See
TracBrowser
for help on using the repository browser.