@@ -136,11 +136,9 @@ def test_login_no_default_user():
136
136
assert casda ._authenticated is False
137
137
assert casda .USERNAME == ''
138
138
139
- with pytest .raises (LoginError ) as excinfo :
139
+ with pytest .raises (LoginError , match = r"If you do not pass a username to login\(\)," ) as excinfo :
140
140
Casda .login ()
141
141
142
- assert "If you do not pass a username to login()," in str (excinfo .value )
143
-
144
142
assert casda ._authenticated is False
145
143
assert casda .USERNAME == ''
146
144
assert hasattr (casda , '_auth' ) is False
@@ -286,11 +284,9 @@ def test_filter_out_unreleased():
286
284
def test_stage_data_unauthorised (patch_get ):
287
285
table = Table ()
288
286
289
- with pytest .raises (ValueError ) as excinfo :
287
+ with pytest .raises (ValueError , match = r"Credentials must be supplied" ) as excinfo :
290
288
Casda .stage_data (table )
291
289
292
- assert "Credentials must be supplied" in str (excinfo .value )
293
-
294
290
295
291
def test_stage_data_empty (patch_get ):
296
292
table = Table ()
@@ -323,11 +319,9 @@ def test_stage_data_no_link(patch_get):
323
319
fake_login (casda , USERNAME , PASSWORD )
324
320
casda .POLL_INTERVAL = 1
325
321
326
- with pytest .raises (ValueError ) as excinfo :
322
+ with pytest .raises (ValueError , match = r"You do not have access to any of the requested data files\." ) as excinfo :
327
323
casda .stage_data (table )
328
324
329
- assert "You do not have access to any of the requested data files." in str (excinfo .value )
330
-
331
325
332
326
def test_stage_data (patch_get ):
333
327
prefix = 'https://somewhere/casda/datalink/links?'
@@ -370,9 +364,9 @@ def test_cutout_no_args(patch_get):
370
364
casda = Casda ()
371
365
fake_login (casda , USERNAME , PASSWORD )
372
366
casda .POLL_INTERVAL = 1
373
- with pytest .raises (ValueError ) as excinfo :
367
+ with pytest .raises (ValueError ,
368
+ match = r"Please provide cutout parameters such as coordinates, band or channel\." ) as excinfo :
374
369
casda .cutout (table )
375
- assert "Please provide cutout parameters such as coordinates, band or channel." in str (excinfo .value )
376
370
377
371
378
372
def test_cutout_unauthorised (patch_get ):
@@ -384,9 +378,8 @@ def test_cutout_unauthorised(patch_get):
384
378
radius = 30 * u .arcmin
385
379
centre = SkyCoord (ra , dec )
386
380
387
- with pytest .raises (ValueError ) as excinfo :
381
+ with pytest .raises (ValueError , match = r"Credentials must be supplied to download CASDA image data" ) as excinfo :
388
382
Casda .cutout (table , coordinates = centre , radius = radius , verbose = True )
389
- assert "Credentials must be supplied to download CASDA image data" in str (excinfo .value )
390
383
391
384
392
385
def test_cutout_no_table (patch_get ):
0 commit comments