@@ -0,0 +1,1462 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst%0A# -*- coding: utf-8 -*-%0A%22%22%22Test desitarget.mtl.%0A%22%22%22%0Aimport unittest%0Afrom importlib import import_module%0A%0Aclass TestSECONDARY(unittest.TestCase):%0A%0A    def setUp(self):%0A        # ADM these are the allowed types of observations of secondaries.%0A        self.flavors = %7B%22SPARE%22, %22DEDICATED%22, %22SSV%22, %22QSO%22, %22TOO%22%7D%0A%0A    def test_flavors(self):%0A        %22%22%22Test that secondary masks only have the allowed flavors.%0A        %22%22%22%0A        # ADM loop over flavors of SV and the main survey to get masks.%0A        from desitarget.targetmask import scnd_mask as Mx%0A        Mxs = %5BMx%5D%0A        svs = 2%0A        for i in range(1, svs):%0A            targmask = import_module(%0A                %22desitarget.sv%7B%7D.sv%7B%7D_targetmask%22.format(i, i))%0A            Mxs.append(targmask.scnd_mask)%0A%0A        # ADM for each mask...%0A        for Mx in Mxs:%0A            # ADM ...if we've already defined the flavor property...%0A            if %22flavor%22 in dir(Mx%5BMx%5B0%5D%5D):%0A                flavs =set(%5BMx%5Bbitname%5D.flavor for bitname in Mx.names()%5D)%0A                # ADM ...all of the included flavors are allowed flavors.%0A                self.assertTrue(flavs.issubset(self.flavors))%0A%0A%0Aif __name__ == '__main__':%0A    unittest.main()%0A%0A%0Adef test_suite():%0A    %22%22%22Allows testing of only this module with the command:%0A%0A        python setup.py test -m desitarget.test.test_mtl%0A    %22%22%22%0A    return unittest.defaultTestLoader.loadTestsFromName(__name__)%0A

add a unit test to check the allowed flavors for secondary target classes