@@ -28,15 +28,15 @@ def setUp(self):
28
28
29
29
def testConstructor1 (self ):
30
30
"Test Farray size constructor"
31
- self .failUnless (isinstance (self .array , Farray .Farray ))
31
+ self .assertTrue (isinstance (self .array , Farray .Farray ))
32
32
33
33
def testConstructor2 (self ):
34
34
"Test Farray copy constructor"
35
35
for i in range (self .nrows ):
36
36
for j in range (self .ncols ):
37
37
self .array [i , j ] = i + j
38
38
arrayCopy = Farray .Farray (self .array )
39
- self .failUnless (arrayCopy == self .array )
39
+ self .assertTrue (arrayCopy == self .array )
40
40
41
41
def testConstructorBad1 (self ):
42
42
"Test Farray size constructor, negative nrows"
@@ -48,15 +48,15 @@ def testConstructorBad2(self):
48
48
49
49
def testNrows (self ):
50
50
"Test Farray nrows method"
51
- self .failUnless (self .array .nrows () == self .nrows )
51
+ self .assertTrue (self .array .nrows () == self .nrows )
52
52
53
53
def testNcols (self ):
54
54
"Test Farray ncols method"
55
- self .failUnless (self .array .ncols () == self .ncols )
55
+ self .assertTrue (self .array .ncols () == self .ncols )
56
56
57
57
def testLen (self ):
58
58
"Test Farray __len__ method"
59
- self .failUnless (len (self .array ) == self .nrows * self .ncols )
59
+ self .assertTrue (len (self .array ) == self .nrows * self .ncols )
60
60
61
61
def testSetGet (self ):
62
62
"Test Farray __setitem__, __getitem__ methods"
@@ -67,7 +67,7 @@ def testSetGet(self):
67
67
self .array [i , j ] = i * j
68
68
for i in range (m ):
69
69
for j in range (n ):
70
- self .failUnless (self .array [i , j ] == i * j )
70
+ self .assertTrue (self .array [i , j ] == i * j )
71
71
72
72
def testSetBad1 (self ):
73
73
"Test Farray __setitem__ method, negative row"
@@ -113,7 +113,7 @@ def testAsString(self):
113
113
for i in range (self .nrows ):
114
114
for j in range (self .ncols ):
115
115
self .array [i , j ] = i + j
116
- self .failUnless (self .array .asString () == result )
116
+ self .assertTrue (self .array .asString () == result )
117
117
118
118
def testStr (self ):
119
119
"Test Farray __str__ method"
@@ -127,19 +127,19 @@ def testStr(self):
127
127
for i in range (self .nrows ):
128
128
for j in range (self .ncols ):
129
129
self .array [i , j ] = i - j
130
- self .failUnless (str (self .array ) == result )
130
+ self .assertTrue (str (self .array ) == result )
131
131
132
132
def testView (self ):
133
133
"Test Farray view method"
134
134
for i in range (self .nrows ):
135
135
for j in range (self .ncols ):
136
136
self .array [i , j ] = i + j
137
137
a = self .array .view ()
138
- self .failUnless (isinstance (a , np .ndarray ))
139
- self .failUnless (a .flags .f_contiguous )
138
+ self .assertTrue (isinstance (a , np .ndarray ))
139
+ self .assertTrue (a .flags .f_contiguous )
140
140
for i in range (self .nrows ):
141
141
for j in range (self .ncols ):
142
- self .failUnless (a [i , j ] == i + j )
142
+ self .assertTrue (a [i , j ] == i + j )
143
143
144
144
######################################################################
145
145
0 commit comments