Commits
428 428 | else: |
429 429 | self.assertEqual(x, exp_dict[k], msg) |
430 430 | # test bogus key fails |
431 431 | k = 'boguskey' |
432 432 | self.assertRaises( |
433 433 | Exception, imhead, datacopy, mode='get', hdkey=k, |
434 434 | msg='Incorrectly found bogus key' |
435 435 | ) |
436 436 | # CAS-13654 |
437 437 | with self.assertRaises(RuntimeError) as cm: |
438 - | casalog.post('xyz', 'SEVERE') |
439 438 | imhead(datacopy, mode='get', hdkey='incr') |
440 - | casalog.post('ab', 'SEVERE') |
441 - | print('ab') |
442 - | exc = cm.exception |
443 - | print('ac') |
444 - | expected_msg = ( |
445 - | 'Uknown keyword incr. If you are trying to use a key name ' |
446 - | 'from the imhead summary dictionary, note that some keys in ' |
447 - | 'mode=\'put\'/\'get\' are different from mode=\'summary\'. ' |
448 - | 'Please see imhead description in the CASA online ' |
449 - | 'documentation for complete details.' |
450 - | ) |
451 - | print('ad') |
452 - | pos = str(exc).find(expected_msg) |
453 - | print('abcdef pos', pos) |
454 - | self.assertNotEqual( |
455 - | pos, -1, msg=f'Unexpected exception was thrown: {exc}' |
456 - | ) |
439 + | exc = cm.exception |
440 + | expected_msg = ( |
441 + | 'Unknown keyword incr. If you are trying to use a key name ' |
442 + | 'from the imhead summary dictionary, note that some keys in ' |
443 + | 'mode=\'put\'/\'get\' are different from mode=\'summary\'. ' |
444 + | 'Please see imhead description in the CASA online ' |
445 + | 'documentation for complete details.' |
446 + | ) |
447 + | pos = str(exc).find(expected_msg) |
448 + | self.assertNotEqual( |
449 + | pos, -1, msg=f'Unexpected exception was thrown: {exc}' |
450 + | ) |
457 451 | |
458 452 | |
459 453 | def test_summary(self): |
460 454 | ''' |
461 455 | test_summary |
462 456 | ----------------- |
463 457 | ''' |
464 458 | ###NOTE: to test the function of the verbose parameter an image with multiple beams is required |
465 459 | summaryDictnoV = { |
466 460 | 'axisnames': np.array(['Right Ascension', 'Declination', 'Stokes', 'Frequency'], dtype='<U16'), |