Commits
David Mehringer authored and Takeshi Nakazato committed 2ca402c80bf Merge
423 423 | try: |
424 424 | self.assertEqual(np.all(x, exp_dict[k]), msg) |
425 425 | except: |
426 426 | # string arrays can throw "Cannot reduce flexible type" exceptions |
427 427 | self.assertEqual(list(x), list(exp_dict[k]), msg) |
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 - | Exception, imhead, datacopy, mode='get', hdkey=k, |
434 - | msg='Incorrectly found bogus key' |
433 + | Exception, imhead, datacopy, mode='get', hdkey=k, |
434 + | msg='Incorrectly found bogus key' |
435 435 | ) |
436 + | # CAS-13654 |
437 + | for k in ('incr', 'axisnames'): |
438 + | with self.assertRaises(RuntimeError) as cm: |
439 + | imhead(datacopy, mode='get', hdkey=k) |
440 + | exc = cm.exception |
441 + | expected_msg = ( |
442 + | f'Unknown keyword {k}. If you are trying to use a key name ' |
443 + | 'from the imhead summary dictionary, note that some keys in ' |
444 + | 'mode=\'put\'/\'get\' are different from mode=\'summary\'. ' |
445 + | 'Please see imhead description in the CASA online ' |
446 + | 'documentation for complete details.' |
447 + | ) |
448 + | pos = str(exc).find(expected_msg) |
449 + | self.assertNotEqual( |
450 + | pos, -1, msg=f'Unexpected exception was thrown: {exc}' |
451 + | ) |
452 + | |
436 453 | |
437 454 | def test_summary(self): |
438 455 | ''' |
439 456 | test_summary |
440 457 | ----------------- |
441 458 | ''' |
442 459 | ###NOTE: to test the function of the verbose parameter an image with multiple beams is required |
443 460 | summaryDictnoV = { |
444 461 | 'axisnames': np.array(['Right Ascension', 'Declination', 'Stokes', 'Frequency'], dtype='<U16'), |
445 462 | 'axisunits': np.array(['rad', 'rad', '', 'Hz'], dtype='<U16'), 'defaultmask': '', |