@@ -31,28 +31,28 @@ def testBasicValueType(self):
3131
3232 def testClassStandardAttrs (self ):
3333 """Test standard class attributes."""
34- self .failUnless (ClassTest .__name__ == 'ClassTest' )
35- self .failUnless (ClassTest .__module__ == 'Python.Test' )
36- self .failUnless (type (ClassTest .__dict__ ) == types .DictProxyType )
37- self .failUnless (len (ClassTest .__doc__ ) > 0 )
34+ self .assertTrue (ClassTest .__name__ == 'ClassTest' )
35+ self .assertTrue (ClassTest .__module__ == 'Python.Test' )
36+ self .assertTrue (type (ClassTest .__dict__ ) == types .DictProxyType )
37+ self .assertTrue (len (ClassTest .__doc__ ) > 0 )
3838
3939
4040 def testClassDocstrings (self ):
4141 """Test standard class docstring generation"""
4242 value = 'Void .ctor()'
43- self .failUnless (ClassTest .__doc__ == value )
43+ self .assertTrue (ClassTest .__doc__ == value )
4444
4545
4646 def testClassDefaultStr (self ):
4747 """Test the default __str__ implementation for managed objects."""
4848 s = System .String ("this is a test" )
49- self .failUnless (str (s ) == "this is a test" )
49+ self .assertTrue (str (s ) == "this is a test" )
5050
5151
5252 def testClassDefaultRepr (self ):
5353 """Test the default __repr__ implementation for managed objects."""
5454 s = System .String ("this is a test" )
55- self .failUnless (repr (s ).startswith ("<System.String object" ))
55+ self .assertTrue (repr (s ).startswith ("<System.String object" ))
5656
5757
5858 def testNonPublicClass (self ):
@@ -62,12 +62,12 @@ def testNonPublicClass(self):
6262 def test ():
6363 from Python .Test import InternalClass
6464
65- self .failUnlessRaises (ImportError , test )
65+ self .assertRaises (ImportError , test )
6666
6767 def test ():
6868 x = Test .InternalClass
6969
70- self .failUnlessRaises (AttributeError , test )
70+ self .assertRaises (AttributeError , test )
7171
7272
7373 def testBasicSubclass (self ):
@@ -79,18 +79,18 @@ def howMany(self):
7979
8080 table = MyTable ()
8181
82- self .failUnless (table .__class__ .__name__ .endswith ('MyTable' ))
83- self .failUnless (type (table ).__name__ .endswith ('MyTable' ))
84- self .failUnless (len (table .__class__ .__bases__ ) == 1 )
85- self .failUnless (table .__class__ .__bases__ [0 ] == Hashtable )
82+ self .assertTrue (table .__class__ .__name__ .endswith ('MyTable' ))
83+ self .assertTrue (type (table ).__name__ .endswith ('MyTable' ))
84+ self .assertTrue (len (table .__class__ .__bases__ ) == 1 )
85+ self .assertTrue (table .__class__ .__bases__ [0 ] == Hashtable )
8686
87- self .failUnless (table .howMany () == 0 )
88- self .failUnless (table .Count == 0 )
87+ self .assertTrue (table .howMany () == 0 )
88+ self .assertTrue (table .Count == 0 )
8989
9090 table .set_Item ('one' , 'one' )
9191
92- self .failUnless (table .howMany () == 1 )
93- self .failUnless (table .Count == 1 )
92+ self .assertTrue (table .howMany () == 1 )
93+ self .assertTrue (table .Count == 1 )
9494
9595 MyTable = None
9696
@@ -116,15 +116,15 @@ def __init__(self, v):
116116 self .value = v
117117
118118 inst = SubClass ('test' )
119- self .failUnless (inst .value == 'test' )
119+ self .assertTrue (inst .value == 'test' )
120120
121121 class SubClass2 (ClassCtorTest2 ):
122122 def __init__ (self , v ):
123123 ClassCtorTest2 .__init__ (self )
124124 self .value = v
125125
126126 inst = SubClass2 ('test' )
127- self .failUnless (inst .value == 'test' )
127+ self .assertTrue (inst .value == 'test' )
128128
129129
130130 def testStructConstruction (self ):
@@ -134,17 +134,17 @@ def testStructConstruction(self):
134134 def test ():
135135 p = Point ()
136136
137- self .failUnlessRaises (TypeError , test )
137+ self .assertRaises (TypeError , test )
138138
139139 p = Point (0 , 0 )
140- self .failUnless (p .X == 0 )
141- self .failUnless (p .Y == 0 )
140+ self .assertTrue (p .X == 0 )
141+ self .assertTrue (p .Y == 0 )
142142
143143 p .X = 10
144144 p .Y = 10
145145
146- self .failUnless (p .X == 10 )
147- self .failUnless (p .Y == 10 )
146+ self .assertTrue (p .X == 10 )
147+ self .assertTrue (p .Y == 10 )
148148
149149
150150
@@ -160,21 +160,21 @@ def testIEnumerableIteration(self):
160160 list = Test .ClassTest .GetArrayList ()
161161
162162 for item in list :
163- self .failUnless ((item > - 1 ) and (item < 10 ))
163+ self .assertTrue ((item > - 1 ) and (item < 10 ))
164164
165165 dict = Test .ClassTest .GetHashtable ()
166166
167167 for item in dict :
168168 cname = item .__class__ .__name__
169- self .failUnless (cname .endswith ('DictionaryEntry' ))
169+ self .assertTrue (cname .endswith ('DictionaryEntry' ))
170170
171171
172172 def testIEnumeratorIteration (self ):
173173 """Test iteration over objects supporting IEnumerator."""
174174 chars = Test .ClassTest .GetEnumerator ()
175175
176176 for item in chars :
177- self .failUnless (item in 'test string' )
177+ self .assertTrue (item in 'test string' )
178178
179179
180180
@@ -193,11 +193,11 @@ def __getitem__(self, key):
193193 table ['two' ] = 'two'
194194 table ['three' ] = 'three'
195195
196- self .failUnless (table ['one' ] == 'my one' )
197- self .failUnless (table ['two' ] == 'my two' )
198- self .failUnless (table ['three' ] == 'my three' )
196+ self .assertTrue (table ['one' ] == 'my one' )
197+ self .assertTrue (table ['two' ] == 'my two' )
198+ self .assertTrue (table ['three' ] == 'my three' )
199199
200- self .failUnless (table .Count == 3 )
200+ self .assertTrue (table .Count == 3 )
201201
202202
203203 def testOverrideSetItem (self ):
@@ -214,11 +214,11 @@ def __setitem__(self, key, value):
214214 table ['two' ] = 'two'
215215 table ['three' ] = 'three'
216216
217- self .failUnless (table ['one' ] == 'my one' )
218- self .failUnless (table ['two' ] == 'my two' )
219- self .failUnless (table ['three' ] == 'my three' )
217+ self .assertTrue (table ['one' ] == 'my one' )
218+ self .assertTrue (table ['two' ] == 'my two' )
219+ self .assertTrue (table ['three' ] == 'my three' )
220220
221- self .failUnless (table .Count == 3 )
221+ self .assertTrue (table .Count == 3 )
222222
223223
224224
0 commit comments