mirror of
https://github.com/boostorg/python.git
synced 2026-01-22 17:32:55 +00:00
initial development of NumericDispatcher
[SVN r8022]
This commit is contained in:
36
test_num.py
Normal file
36
test_num.py
Normal file
@@ -0,0 +1,36 @@
|
||||
r'''
|
||||
>>> i1 = Int(1)
|
||||
>>> i2 = Int(2)
|
||||
>>> i = i1 + i2
|
||||
>>> i.i()
|
||||
3
|
||||
>>> i = i1 - i2
|
||||
>>> i.i()
|
||||
-1
|
||||
>>> i = i1 + 5
|
||||
>>> i.i()
|
||||
6
|
||||
>>> i = 3 + i2
|
||||
>>> i.i()
|
||||
5
|
||||
>>> i = i1 - 3
|
||||
Traceback (innermost last):
|
||||
TypeError: incompatible arguments for -
|
||||
>>> i = 3 - i1
|
||||
Traceback (innermost last):
|
||||
TypeError: incompatible arguments for -
|
||||
'''
|
||||
|
||||
from num import *
|
||||
import string
|
||||
import re
|
||||
import sys
|
||||
|
||||
def run(args = None):
|
||||
if args is not None:
|
||||
sys.argv = args
|
||||
import doctest, test_num
|
||||
doctest.testmod(test_num)
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
Reference in New Issue
Block a user