Skip to content

Commit 4a1d077

Browse files
committed
Added implicit conversion tests
[SVN r12386]
1 parent f7a5e6d commit 4a1d077

1 file changed

Lines changed: 71 additions & 3 deletions

File tree

‎test/newtest.py‎

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,82 @@
6060
Create an extension class which wraps "complicated" (init1 and get_n)
6161
are a complicated constructor and member function, respectively.
6262
63-
>>> C = xclass('C', (xinst,), {'__init__': init1, 'get_n': get_n})
64-
>>> c1 = C(s, 99)
63+
>>> c1 = complicated(s, 99)
6564
>>> c1.get_n()
6665
99
67-
>>> c2 = C(s)
66+
>>> c2 = complicated(s)
6867
>>> c2.get_n()
6968
0
7069
70+
>>> a = A()
71+
>>> b = B()
72+
>>> c = C()
73+
>>> d = D()
74+
75+
------
76+
>>> take_a(a)
77+
0
78+
79+
>>> try:
80+
... take_b(a)
81+
... except: pass
82+
... else: print 'no exception'
83+
84+
>>> try:
85+
... take_c(a)
86+
... except: pass
87+
... else: print 'no exception'
88+
89+
>>> try:
90+
... take_d(a)
91+
... except: pass
92+
... else: print 'no exception'
93+
94+
------
95+
>>> take_a(b)
96+
0
97+
98+
>>> take_b(b)
99+
1
100+
101+
>>> try:
102+
... take_c(b)
103+
... except: pass
104+
... else: print 'no exception'
105+
106+
>>> try:
107+
... take_d(b)
108+
... except: pass
109+
... else: print 'no exception'
110+
111+
-------
112+
>>> take_a(c)
113+
0
114+
115+
>>> try:
116+
... take_b(c)
117+
... except: pass
118+
... else: print 'no exception'
119+
120+
>>> take_c(c)
121+
2
122+
123+
>>> try:
124+
... take_d(c)
125+
... except: pass
126+
... else: print 'no exception'
127+
128+
-------
129+
>>> take_a(d)
130+
0
131+
>>> take_b(d)
132+
1
133+
>>> take_c(d)
134+
2
135+
>>> take_d(d)
136+
3
137+
138+
71139
"""
72140

73141
def run(args = None):

0 commit comments

Comments
 (0)