@@ -159,7 +159,7 @@ def test_threadsafety(self):
159
159
# Must exist
160
160
threadsafety = self .driver .threadsafety
161
161
# Must be a valid value
162
- self .failUnless (threadsafety in (0 ,1 ,2 ,3 ))
162
+ self .assertTrue (threadsafety in (0 ,1 ,2 ,3 ))
163
163
except AttributeError :
164
164
self .fail ("Driver doesn't define threadsafety" )
165
165
@@ -168,7 +168,7 @@ def test_paramstyle(self):
168
168
# Must exist
169
169
paramstyle = self .driver .paramstyle
170
170
# Must be a valid value
171
- self .failUnless (paramstyle in (
171
+ self .assertTrue (paramstyle in (
172
172
'qmark' ,'numeric' ,'named' ,'format' ,'pyformat'
173
173
))
174
174
except AttributeError :
@@ -177,27 +177,27 @@ def test_paramstyle(self):
177
177
def test_Exceptions (self ):
178
178
# Make sure required exceptions exist, and are in the
179
179
# defined heirarchy.
180
- self .failUnless (issubclass (self .driver .Warning ,StandardError ))
181
- self .failUnless (issubclass (self .driver .Error ,StandardError ))
182
- self .failUnless (
180
+ self .assertTrue (issubclass (self .driver .Warning ,StandardError ))
181
+ self .assertTrue (issubclass (self .driver .Error ,StandardError ))
182
+ self .assertTrue (
183
183
issubclass (self .driver .InterfaceError ,self .driver .Error )
184
184
)
185
- self .failUnless (
185
+ self .assertTrue (
186
186
issubclass (self .driver .DatabaseError ,self .driver .Error )
187
187
)
188
- self .failUnless (
188
+ self .assertTrue (
189
189
issubclass (self .driver .OperationalError ,self .driver .Error )
190
190
)
191
- self .failUnless (
191
+ self .assertTrue (
192
192
issubclass (self .driver .IntegrityError ,self .driver .Error )
193
193
)
194
- self .failUnless (
194
+ self .assertTrue (
195
195
issubclass (self .driver .InternalError ,self .driver .Error )
196
196
)
197
- self .failUnless (
197
+ self .assertTrue (
198
198
issubclass (self .driver .ProgrammingError ,self .driver .Error )
199
199
)
200
- self .failUnless (
200
+ self .assertTrue (
201
201
issubclass (self .driver .NotSupportedError ,self .driver .Error )
202
202
)
203
203
@@ -210,15 +210,15 @@ def test_ExceptionsAsConnectionAttributes(self):
210
210
# by default.
211
211
con = self ._connect ()
212
212
drv = self .driver
213
- self .failUnless (con .Warning is drv .Warning )
214
- self .failUnless (con .Error is drv .Error )
215
- self .failUnless (con .InterfaceError is drv .InterfaceError )
216
- self .failUnless (con .DatabaseError is drv .DatabaseError )
217
- self .failUnless (con .OperationalError is drv .OperationalError )
218
- self .failUnless (con .IntegrityError is drv .IntegrityError )
219
- self .failUnless (con .InternalError is drv .InternalError )
220
- self .failUnless (con .ProgrammingError is drv .ProgrammingError )
221
- self .failUnless (con .NotSupportedError is drv .NotSupportedError )
213
+ self .assertTrue (con .Warning is drv .Warning )
214
+ self .assertTrue (con .Error is drv .Error )
215
+ self .assertTrue (con .InterfaceError is drv .InterfaceError )
216
+ self .assertTrue (con .DatabaseError is drv .DatabaseError )
217
+ self .assertTrue (con .OperationalError is drv .OperationalError )
218
+ self .assertTrue (con .IntegrityError is drv .IntegrityError )
219
+ self .assertTrue (con .InternalError is drv .InternalError )
220
+ self .assertTrue (con .ProgrammingError is drv .ProgrammingError )
221
+ self .assertTrue (con .NotSupportedError is drv .NotSupportedError )
222
222
223
223
224
224
def test_commit (self ):
@@ -310,12 +310,12 @@ def test_rowcount(self):
310
310
cur .execute ("insert into %sbooze values ('Victoria Bitter')" % (
311
311
self .table_prefix
312
312
))
313
- self .failUnless (cur .rowcount in (- 1 ,1 ),
313
+ self .assertTrue (cur .rowcount in (- 1 ,1 ),
314
314
'cursor.rowcount should == number or rows inserted, or '
315
315
'set to -1 after executing an insert statement'
316
316
)
317
317
cur .execute ("select name from %sbooze" % self .table_prefix )
318
- self .failUnless (cur .rowcount in (- 1 ,1 ),
318
+ self .assertTrue (cur .rowcount in (- 1 ,1 ),
319
319
'cursor.rowcount should == number of rows returned, or '
320
320
'set to -1 after executing a select statement'
321
321
)
@@ -378,7 +378,7 @@ def _paraminsert(self,cur):
378
378
cur .execute ("insert into %sbooze values ('Victoria Bitter')" % (
379
379
self .table_prefix
380
380
))
381
- self .failUnless (cur .rowcount in (- 1 ,1 ))
381
+ self .assertTrue (cur .rowcount in (- 1 ,1 ))
382
382
383
383
if self .driver .paramstyle == 'qmark' :
384
384
cur .execute (
@@ -407,7 +407,7 @@ def _paraminsert(self,cur):
407
407
)
408
408
else :
409
409
self .fail ('Invalid paramstyle' )
410
- self .failUnless (cur .rowcount in (- 1 ,1 ))
410
+ self .assertTrue (cur .rowcount in (- 1 ,1 ))
411
411
412
412
cur .execute ('select name from %sbooze' % self .table_prefix )
413
413
res = cur .fetchall ()
@@ -459,7 +459,7 @@ def test_executemany(self):
459
459
)
460
460
else :
461
461
self .fail ('Unknown paramstyle' )
462
- self .failUnless (cur .rowcount in (- 1 ,2 ),
462
+ self .assertTrue (cur .rowcount in (- 1 ,2 ),
463
463
'insert using cursor.executemany set cursor.rowcount to '
464
464
'incorrect value %r' % cur .rowcount
465
465
)
@@ -494,7 +494,7 @@ def test_fetchone(self):
494
494
'cursor.fetchone should return None if a query retrieves '
495
495
'no rows'
496
496
)
497
- self .failUnless (cur .rowcount in (- 1 ,0 ))
497
+ self .assertTrue (cur .rowcount in (- 1 ,0 ))
498
498
499
499
# cursor.fetchone should raise an Error if called after
500
500
# executing a query that cannnot return rows
@@ -514,7 +514,7 @@ def test_fetchone(self):
514
514
self .assertEqual (cur .fetchone (),None ,
515
515
'cursor.fetchone should return None if no more rows available'
516
516
)
517
- self .failUnless (cur .rowcount in (- 1 ,1 ))
517
+ self .assertTrue (cur .rowcount in (- 1 ,1 ))
518
518
finally :
519
519
con .close ()
520
520
@@ -570,7 +570,7 @@ def test_fetchmany(self):
570
570
'cursor.fetchmany should return an empty sequence after '
571
571
'results are exhausted'
572
572
)
573
- self .failUnless (cur .rowcount in (- 1 ,6 ))
573
+ self .assertTrue (cur .rowcount in (- 1 ,6 ))
574
574
575
575
# Same as above, using cursor.arraysize
576
576
cur .arraysize = 4
@@ -583,12 +583,12 @@ def test_fetchmany(self):
583
583
self .assertEqual (len (r ),2 )
584
584
r = cur .fetchmany () # Should be an empty sequence
585
585
self .assertEqual (len (r ),0 )
586
- self .failUnless (cur .rowcount in (- 1 ,6 ))
586
+ self .assertTrue (cur .rowcount in (- 1 ,6 ))
587
587
588
588
cur .arraysize = 6
589
589
cur .execute ('select name from %sbooze' % self .table_prefix )
590
590
rows = cur .fetchmany () # Should get all rows
591
- self .failUnless (cur .rowcount in (- 1 ,6 ))
591
+ self .assertTrue (cur .rowcount in (- 1 ,6 ))
592
592
self .assertEqual (len (rows ),6 )
593
593
self .assertEqual (len (rows ),6 )
594
594
rows = [r [0 ] for r in rows ]
@@ -605,7 +605,7 @@ def test_fetchmany(self):
605
605
'cursor.fetchmany should return an empty sequence if '
606
606
'called after the whole result set has been fetched'
607
607
)
608
- self .failUnless (cur .rowcount in (- 1 ,6 ))
608
+ self .assertTrue (cur .rowcount in (- 1 ,6 ))
609
609
610
610
self .executeDDL2 (cur )
611
611
cur .execute ('select name from %sbarflys' % self .table_prefix )
@@ -614,7 +614,7 @@ def test_fetchmany(self):
614
614
'cursor.fetchmany should return an empty sequence if '
615
615
'query retrieved no rows'
616
616
)
617
- self .failUnless (cur .rowcount in (- 1 ,0 ))
617
+ self .assertTrue (cur .rowcount in (- 1 ,0 ))
618
618
619
619
finally :
620
620
con .close ()
@@ -638,7 +638,7 @@ def test_fetchall(self):
638
638
639
639
cur .execute ('select name from %sbooze' % self .table_prefix )
640
640
rows = cur .fetchall ()
641
- self .failUnless (cur .rowcount in (- 1 ,len (self .samples )))
641
+ self .assertTrue (cur .rowcount in (- 1 ,len (self .samples )))
642
642
self .assertEqual (len (rows ),len (self .samples ),
643
643
'cursor.fetchall did not retrieve all rows'
644
644
)
@@ -654,12 +654,12 @@ def test_fetchall(self):
654
654
'cursor.fetchall should return an empty list if called '
655
655
'after the whole result set has been fetched'
656
656
)
657
- self .failUnless (cur .rowcount in (- 1 ,len (self .samples )))
657
+ self .assertTrue (cur .rowcount in (- 1 ,len (self .samples )))
658
658
659
659
self .executeDDL2 (cur )
660
660
cur .execute ('select name from %sbarflys' % self .table_prefix )
661
661
rows = cur .fetchall ()
662
- self .failUnless (cur .rowcount in (- 1 ,0 ))
662
+ self .assertTrue (cur .rowcount in (- 1 ,0 ))
663
663
self .assertEqual (len (rows ),0 ,
664
664
'cursor.fetchall should return an empty list if '
665
665
'a select query returns no rows'
@@ -681,7 +681,7 @@ def test_mixedfetch(self):
681
681
rows23 = cur .fetchmany (2 )
682
682
rows4 = cur .fetchone ()
683
683
rows56 = cur .fetchall ()
684
- self .failUnless (cur .rowcount in (- 1 ,6 ))
684
+ self .assertTrue (cur .rowcount in (- 1 ,6 ))
685
685
self .assertEqual (len (rows23 ),2 ,
686
686
'fetchmany returned incorrect number of rows'
687
687
)
@@ -758,7 +758,7 @@ def test_arraysize(self):
758
758
con = self ._connect ()
759
759
try :
760
760
cur = con .cursor ()
761
- self .failUnless (hasattr (cur ,'arraysize' ),
761
+ self .assertTrue (hasattr (cur ,'arraysize' ),
762
762
'cursor.arraysize must be defined'
763
763
)
764
764
finally :
@@ -827,27 +827,27 @@ def test_Binary(self):
827
827
b = self .driver .Binary ('' )
828
828
829
829
def test_STRING (self ):
830
- self .failUnless (hasattr (self .driver ,'STRING' ),
830
+ self .assertTrue (hasattr (self .driver ,'STRING' ),
831
831
'module.STRING must be defined'
832
832
)
833
833
834
834
def test_BINARY (self ):
835
- self .failUnless (hasattr (self .driver ,'BINARY' ),
835
+ self .assertTrue (hasattr (self .driver ,'BINARY' ),
836
836
'module.BINARY must be defined.'
837
837
)
838
838
839
839
def test_NUMBER (self ):
840
- self .failUnless (hasattr (self .driver ,'NUMBER' ),
840
+ self .assertTrue (hasattr (self .driver ,'NUMBER' ),
841
841
'module.NUMBER must be defined.'
842
842
)
843
843
844
844
def test_DATETIME (self ):
845
- self .failUnless (hasattr (self .driver ,'DATETIME' ),
845
+ self .assertTrue (hasattr (self .driver ,'DATETIME' ),
846
846
'module.DATETIME must be defined.'
847
847
)
848
848
849
849
def test_ROWID (self ):
850
- self .failUnless (hasattr (self .driver ,'ROWID' ),
850
+ self .assertTrue (hasattr (self .driver ,'ROWID' ),
851
851
'module.ROWID must be defined.'
852
852
)
853
853
0 commit comments