def test_size_m(self): ''' Confirm contents of size table type M''' star = _Star() table_data = [ 'II', 'II', 'II', 'II', 'III', 'V', 'V', 'V', 'V', 'V', 'VI', 'D', 'VI', 'VI', 'VI' ] self.check_table_contents(table_data, star.size_m_table)
def test_spectral_type_table(self): '''Confirm contents of spectral type table''' star = _Star() table_data = [ 'OB', 'A', 'A', 'F', 'F', 'G', 'G', 'K', 'K', 'M', 'M', 'M', 'BD', 'BD', 'BD' ] self.check_table_contents(table_data, star.spectral_type_table)
def test_size_a(self): ''' Confirm contents of size table type A''' star = _Star() table_data = [ 'Ia', 'Ia', 'Ib', 'II', 'III', 'IV', 'V', 'V', 'V', 'V', 'V', 'D', 'V', 'V', 'V' ] self.check_table_contents(table_data, star.size_a_table)
def test_f_vi_decimal(self): '''Confirm F VI has decimals in range 0-4''' for _ in range(0, SAMPLE_SIZE): star = _Star() star.spectral_type = 'F' star.size = 'VI' star.set_decimal() print(star.decimal) self.assertTrue(star.decimal <= 4)
def check_hz_orbits(self): '''Test HZ orbits''' hz_table = { 'O': { 'Ia': 15, 'Ib': 15, 'II': 14, 'III': 13, 'IV': 12, 'V': 11, 'VI': None, 'D': 1 }, 'B': { 'Ia': 13, 'Ib': 13, 'II': 12, 'III': 11, 'IV': 10, 'V': 9, 'VI': None, 'D': 0 }, 'A': { 'Ia': 12, 'Ib': 11, 'II': 9, 'III': 7, 'IV': 7, 'V': 7, 'VI': None, 'D': 0 }, 'F': { 'Ia': 11, 'Ib': 10, 'II': 9, 'III': 6, 'IV': 6, 'V': 5, 'VI': 3, 'D': 0 }, 'G': { 'Ia': 12, 'Ib': 10, 'II': 9, 'III': 7, 'IV': 5, 'V': 3, 'VI': 2, 'D': 0 }, 'K': { 'Ia': 12, 'Ib': 10, 'II': 9, 'III': 8, 'IV': 5, 'V': 2, 'VI': 1, 'D': 0 }, 'M': { 'Ia': 12, 'Ib': 11, 'II': 10, 'III': 9, 'IV': None, 'V': 0, 'VI': 0, 'D': 0 } } for sta in 'OBAFGKM': for siz in ['Ia', 'Ia', 'II', 'III', 'IV', 'V', 'VI', 'D']: star = _Star() star.spectral_type = sta star.size = siz star.set_hz() print('st = {} sz = {} hz_table = {} star.habitable_zone = {}'. format(sta, siz, hz_table[sta][siz], star.habitable_zone)) self.assertTrue(star.habitable_zone == hz_table[sta][siz])