def test_sun(): s = Seismology(vmax0, deltav0, Teff0) s.getAll() assert s.mass == 1.00 assert s.radius == 1.00 assert s.logg == 4.44 assert s.density == 1.41
def test_getDensity(): s = Seismology(vmax0, deltav0, Teff0) assert not hasattr(s, 'mass') s.getDensity() assert hasattr(s, 'mass') assert hasattr(s, 'radius') assert hasattr(s, 'density') assert not hasattr(s, 'logg')
def test_simple(): vmax = 1 deltav = 200 Teff = 5000 s = Seismology(vmax, deltav, Teff) assert isinstance(s, Seismology) assert isinstance(s.vmax, float) assert isinstance(s.deltav, float) assert isinstance(s.Teff, float) assert s.vmax == 1 / vmax0 assert s.deltav == deltav / deltav0 assert s.Teff == Teff / Teff0 assert repr(s) == 'Nothing calculated yet. Use "Seismology.getAll()"' s.getAll() assert 'logg' in repr(s) assert 'density' in repr(s) assert hasattr(s, 'mass') assert hasattr(s, 'radius') assert hasattr(s, 'logg') assert hasattr(s, 'density') assert s.mass > 0 assert s.radius > 0 assert s.density > 0 assert s.logg > 0 assert isinstance(s.mass, float) assert isinstance(s.radius, float) assert isinstance(s.density, float) assert isinstance(s.logg, float)
def test_not_in_range(vmax, deltav, Teff): with pytest.raises(ValueError): Seismology(vmax, deltav, Teff)
def test_negative_and_zero_values(vmax, deltav, Teff): with pytest.raises(ValueError): Seismology(vmax, deltav, Teff)
def getSeismicInformation(self, vmax: float, deltav: float, Teff: int) -> None: self.seismic = Seismology(vmax, deltav, Teff) self.seismic.getAll() self.seismicInformation = True print('Values can be reached through: Star.seismic.')