def setup_class(self): print "engine init", engine connect(user='******', name='starplex_test') print "engine after connect", engine self.session = Session() drop_all() create_all() catalog = Catalog(self.mock_dataset.catalog_name, self.mock_dataset.instrument_name, None, fits_path=self.mock_dataset.fits_path) for i in xrange(self.mock_dataset.n): cstar = CatalogStar(0., 0., self.mock_dataset.ra[i], self.mock_dataset.dec[i], 0., 0., 1.) for j, bandname in enumerate(self.mock_dataset.bands): bp = Bandpass.as_unique(self.session, bandname, self.mock_dataset.band_sys) obs = Observation(self.mock_dataset.mags[j][i], 0.) obs.bandpass = bp cstar.observations.append(obs) catalog.catalog_stars.append(cstar) self.session.add(catalog)
def test_bandpass_uniqueness(self): bp0 = Bandpass.as_unique(self.session, "V", "Vega") bp1 = Bandpass.as_unique(self.session, "B", "Vega") bp0b = Bandpass.as_unique(self.session, "V", "Vega") assert bp0 is bp0b assert bp1 is not bp0