コード例 #1
0
def test_create():
    test_subject = PixelCutoutHDU([(1, 200), (305, 600)], 7)
    assert test_subject.get_extension() == 7, 'Wrong extension.'

    test_subject = PixelCutoutHDU([(1, 200), (30)], 'SCI,5')
    assert test_subject.get_extension() == ('SCI', 5), 'Wrong extension.'

    test_subject = PixelCutoutHDU(extension='5')
    assert test_subject.get_extension() == 5, 'Wrong extension.'
コード例 #2
0
def test_create():
    test_subject = PixelCutoutHDU([(1, 200), (305, 600)], 7)
    assert test_subject.get_extension() == 7, 'Wrong extension.'

    test_subject = PixelCutoutHDU([(1, 200), (30)], 'SCI,5')
    assert test_subject.get_extension() == ('SCI', 5), 'Wrong extension.'

    test_subject = PixelCutoutHDU([(99, 101), (44, 66)], 'AMS ,2')
    assert test_subject.get_extension() == ('AMS', 2), \
        'Wrong extension (didn' 't filter out spaces)'

    test_subject = PixelCutoutHDU([(12, 30)], 'EXT,0')
    assert test_subject.get_extension() == ('EXT', 1)

    with pytest.raises(ValueError,
                       match=r"Specifying XTENSION return type "
                       r"is not supported\."):
        PixelCutoutHDU([(23, 67), (23, 89)], extension='SCI, 3, i')

    test_subject = PixelCutoutHDU(extension='5')
    assert test_subject.get_extension() == 5, 'Wrong extension.'

    test_subject = PixelCutoutHDU([()])
    assert test_subject.get_extension() == 0