def test_hst_filename(): """Verify basename of a standard hst filename.""" hst_name = "hstimagex_cal.fits" shortname, extname, extver = util.verify_filename(filename=hst_name) short_compare = ntpath.basename(shortname) assert_equal(hst_name, short_compare) assert_equal(extname, None) assert_equal(extver, None)
def test_hst_filename(): """Verify split of a standard hst filename.""" hst_name = "hstimagex_cal.fits" shortname, extname, extver = util.verify_filename(filename=hst_name) short_compare = shortname.split("/")[-1] assert_equal(hst_name, short_compare) assert_equal(extname, None) assert_equal(extver, None)
def test_extname(): """Verify that specifying an extname gets recorded correctly.""" hst_name = "hstimagex_cal.fits" shortname, extname, extver = util.verify_filename(filename=hst_name, extname='sci') short_compare = ntpath.basename(shortname) assert_equal(hst_name, short_compare) assert_equal(extname, 'sci') assert_equal(extver, None)
def test_name_ver_filename(): """Verify basename of a filename given name and ver.""" hst_name_ver = "hstimagex_cal.fits[1]" rootname = "hstimagex_cal.fits" shortname, extname, extver = util.verify_filename(filename=hst_name_ver) short_compare = ntpath.basename(shortname) assert_equal(rootname, short_compare) assert_equal(extname, None) assert_equal(extver, 1)
def test_name_ver_filename(): """Verify split of a filename given name and ver.""" hst_name_ver = "hstimagex_cal.fits[1]" rootname = "hstimagex_cal.fits" shortname, extname, extver = util.verify_filename(filename=hst_name_ver) short_compare = shortname.split("/")[-1] assert_equal(rootname, short_compare) assert_equal(extname, None) assert_equal(extver, 1)
def test_name_ver(): """Verify that specifying both name and ver gets recorded correctly.""" hst_name = "hstimagex_cal.fits" shortname, extname, extver = util.verify_filename(filename=hst_name, extname='sci', extver=1) short_compare = shortname.split("/")[-1] assert_equal(hst_name, short_compare) assert_equal(extname, 'sci') assert_equal(extver, 1)
def test_extver(): """Verify that specifying an extver gets recorded correctly. extver is the extension number explicitly""" hst_name = "hstimagex_cal.fits" shortname, extname, extver = util.verify_filename(filename=hst_name, extver=1) short_compare = ntpath.basename(shortname) assert_equal(hst_name, short_compare) assert_equal(extname, None) assert_equal(extver, 1)