@@ -480,10 +480,10 @@ def test_raise_on_usecols_names_mismatch(self):
480
480
# GH 14671
481
481
data = 'a,b,c,d\n 1,2,3,4\n 5,6,7,8'
482
482
483
- if self . engine == 'c' :
484
- msg = " do not match columns, columns expected but not found "
485
- else :
486
- msg = 'is not in list'
483
+ msg = (
484
+ "Usecols do not match columns, "
485
+ "columns expected but not found: {}"
486
+ )
487
487
488
488
usecols = ['a' , 'b' , 'c' , 'd' ]
489
489
df = self .read_csv (StringIO (data ), usecols = usecols )
@@ -492,11 +492,11 @@ def test_raise_on_usecols_names_mismatch(self):
492
492
tm .assert_frame_equal (df , expected )
493
493
494
494
usecols = ['a' , 'b' , 'c' , 'f' ]
495
- with tm .assert_raises_regex (ValueError , msg ):
495
+ with tm .assert_raises_regex (ValueError , msg . format ([ 'f' ]) ):
496
496
self .read_csv (StringIO (data ), usecols = usecols )
497
497
498
498
usecols = ['a' , 'b' , 'f' ]
499
- with tm .assert_raises_regex (ValueError , msg ):
499
+ with tm .assert_raises_regex (ValueError , msg . format ([ 'f' ]) ):
500
500
self .read_csv (StringIO (data ), usecols = usecols )
501
501
502
502
names = ['A' , 'B' , 'C' , 'D' ]
@@ -520,9 +520,9 @@ def test_raise_on_usecols_names_mismatch(self):
520
520
# tm.assert_frame_equal(df, expected)
521
521
522
522
usecols = ['A' , 'B' , 'C' , 'f' ]
523
- with tm .assert_raises_regex (ValueError , msg ):
523
+ with tm .assert_ra (ValueError , msg . format ([ 'f' ]) ):
524
524
self .read_csv (StringIO (data ), header = 0 , names = names ,
525
525
usecols = usecols )
526
526
usecols = ['A' , 'B' , 'f' ]
527
- with tm .assert_raises_regex (ValueError , msg ):
527
+ with tm .assert_raises_regex (ValueError , msg . format ([ 'f' ]) ):
528
528
self .read_csv (StringIO (data ), names = names , usecols = usecols )
0 commit comments