Пример #1
0
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
Пример #2
0
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')
Пример #3
0
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)
Пример #4
0
def test_not_in_range(vmax, deltav, Teff):
    with pytest.raises(ValueError):
        Seismology(vmax, deltav, Teff)
Пример #5
0
def test_negative_and_zero_values(vmax, deltav, Teff):
    with pytest.raises(ValueError):
        Seismology(vmax, deltav, Teff)
Пример #6
0
 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.')