Пример #1
0
 def test_tech_level(self):
     '''Test tech level results'''
     planet = Planet()
     for starport in 'ABCX':
         for siz in '01234':
             for atm in '0123ABCDEF':
                 for hyd in '9A':
                     for pop in '123459A':
                         for gov in '05D':
                             planet.starport = starport
                             planet.size = upp.Size(siz)
                             planet.atmosphere = upp.Atmosphere(atm)
                             planet.hydrographics = upp.Hydrographics(hyd)
                             planet.population = upp.Population(pop)
                             planet.government = upp.Government(gov)
                             planet.determine_tech()
                             starport_dm =\
                                 self._starport_dm(planet.starport)
                             siz_dm = self._size_dm(str(planet.size))
                             atm_dm = self._atm_dm(str(planet.atmosphere))
                             hyd_dm = self._hyd_dm(str(
                                 planet.hydrographics))
                             pop_dm = self._pop_dm(str(planet.population))
                             gov_dm = self._gov_dm(str(planet.government))
                             print(
                                 'port: {} siz: {} atm: {} hyd: {} pop: {} gov: {}'
                                 .format(starport_dm, siz_dm, atm_dm,
                                         hyd_dm, pop_dm, gov_dm))
                             tl_dm = starport_dm + siz_dm + atm_dm + hyd_dm
                             tl_dm = tl_dm + pop_dm + gov_dm
                             tech_level = int(planet.tech_level)
                             print('upp: {} TL: {} TL DM: {}'.format(
                                 str(planet), tech_level, tl_dm))
                             self.assertTrue(tech_level -
                                             tl_dm in range(1, 7))
Пример #2
0
 def test_in(self):
     '''Test In'''
     for atm in '3568ABC':
         for pop in '012345678':
             planet = Planet()
             planet.atmosphere = uwp.Atmosphere(atm)
             planet.population = uwp.Population(pop)
             self.assertFalse('In' in gen_trade_codes(planet))
Пример #3
0
 def test_in(self):
     '''Test In'''
     for atm in '012479':
         for pop in '9A':
             planet = Planet()
             planet.atmosphere = uwp.Atmosphere(atm)
             planet.population = uwp.Population(pop)
             self.assertTrue('In' in gen_trade_codes(planet))
Пример #4
0
 def test_ri(self):
     '''Test Ri'''
     for atm in '01234579ABC':
         for pop in '0123459ABCDEF':
             for gov in '012ABCDEF':
                 planet = Planet()
                 planet.atmosphere = uwp.Atmosphere(atm)
                 planet.population = uwp.Population(pop)
                 planet.government = uwp.Government(gov)
                 self.assertFalse('Ri' in gen_trade_codes(planet))
Пример #5
0
 def test_no_na(self):
     '''Test !Na'''
     for atm in '456789ABC':
         for hyd in '456789A':
             for pop in '012345':
                 planet = Planet()
                 planet.atmosphere = uwp.Atmosphere(atm)
                 planet.hydrographics = uwp.Hydrographics(hyd)
                 planet.population = uwp.Population(pop)
                 self.assertFalse('Na' in gen_trade_codes(planet))
Пример #6
0
 def test_ri(self):
     '''Test Ri'''
     for atm in '68':
         for pop in '678':
             for gov in '456789':
                 planet = Planet()
                 planet.atmosphere = uwp.Atmosphere(atm)
                 planet.population = uwp.Population(pop)
                 planet.government = uwp.Government(gov)
                 self.assertTrue('Ri' in gen_trade_codes(planet))
Пример #7
0
 def test_no_ag(self):
     '''Test !Ag'''
     for atm in '0123ABC':
         for hyd in '01239A':
             for pop in '012389ABCDEF':
                 planet = Planet()
                 planet.atmosphere = uwp.Atmosphere(atm)
                 planet.hydrographics = uwp.Hydrographics(hyd)
                 planet.population = uwp.Population(pop)
                 self.assertFalse('Ag' in gen_trade_codes(planet))
Пример #8
0
 def test_not_di(self):
     '''Test !Di'''
     for pop in '123456789ABCDEF':
         for gov in '123456789ABCDEF':
             for law in '123456789ABCDEFGHJ':
                 planet = Planet()
                 planet.population = uwp.Population(pop)
                 planet.government = uwp.Government(gov)
                 planet.law_level = uwp.LawLevel(law)
                 self.assertFalse('Di' in gen_trade_codes(planet))
Пример #9
0
 def test_ag(self):
     '''Test Ag'''
     for atm in '456789':
         for hyd in '45678':
             for pop in '567':
                 planet = Planet()
                 planet.atmosphere = uwp.Atmosphere(atm)
                 planet.hydrographics = uwp.Hydrographics(hyd)
                 planet.population = uwp.Population(pop)
                 self.assertTrue('Ag' in gen_trade_codes(planet))
Пример #10
0
 def test_ba(self):
     '''Test Ba'''
     pop = 0
     gov = 0
     law = 0
     tl = 0
     planet = Planet()
     planet.population = uwp.Population(pop)
     planet.government = uwp.Government(gov)
     planet.law_level = uwp.LawLevel(law)
     planet.tech_level = uwp.TechLevel(tl)
     self.assertTrue('Ba' in gen_trade_codes(planet))
Пример #11
0
 def test_no_px(self):
     '''Test !Px'''
     for atm in '01456789C':
         for hyd in '6789A':
             for pop in '012789ABCDEF':
                 for law in '012345ABCDEF':
                     # Also need to check MW
                     planet = Planet()
                     planet.atmosphere = uwp.Atmosphere(atm)
                     planet.hydrographics = uwp.Hydrographics(hyd)
                     planet.population = uwp.Population(pop)
                     planet.law_level = uwp.LawLevel(law)
                     self.assertFalse('Px' in gen_trade_codes(planet))
Пример #12
0
 def test_px(self):
     '''Test Px'''
     for atm in '23AB':
         for hyd in '12345':
             for pop in '3456':
                 for law in '6789':
                     # Also need to check MW
                     planet = Planet()
                     planet.atmosphere = uwp.Atmosphere(atm)
                     planet.hydrographics = uwp.Hydrographics(hyd)
                     planet.population = uwp.Population(pop)
                     planet.law_level = uwp.LawLevel(law)
                     self.assertTrue('Px' in gen_trade_codes(planet))
Пример #13
0
 def test_not_ba(self):
     '''Test !Ba'''
     for pop in '123456789A':
         for gov in '123456789AB':
             for law in '123456789A':  # Assume the rest are OK
                 for tech in '123456':  # Assume the rest are OK
                     for starport in 'ABCD':
                         planet = Planet()
                         planet.starport = starport
                         planet.population = uwp.Population(pop)
                         planet.government = uwp.Government(gov)
                         planet.law_level = uwp.LawLevel(law)
                         planet.tech_level = uwp.TechLevel(tech)
                         self.assertFalse('Ba' in gen_trade_codes(planet))
Пример #14
0
 def test_ni(self):
     '''Test Ni'''
     for pop in '456':
         planet = Planet()
         planet.population = uwp.Population(pop)
         self.assertTrue('Ni' in gen_trade_codes(planet))
Пример #15
0
 def test_hi(self):
     '''Test Hi'''
     for pop in '9ABCDEF':
         planet = Planet()
         planet.population = uwp.Population(pop)
         self.assertTrue('Hi' in gen_trade_codes(planet))
Пример #16
0
 def test_not_hi(self):
     '''Test !Hi'''
     for pop in '012345678':
         planet = Planet()
         planet.population = uwp.Population(pop)
         self.assertFalse('Hi' in gen_trade_codes(planet))
Пример #17
0
 def test_not_ni(self):
     '''Test !Ni'''
     for pop in '0123789ABC':
         planet = Planet()
         planet.population = uwp.Population(pop)
         self.assertFalse('Ni' in gen_trade_codes(planet))
Пример #18
0
 def test_not_lo(self):
     '''Test !Lo'''
     for pop in '0456789ABCDEF':
         planet = Planet()
         planet.population = uwp.Population(pop)
         self.assertFalse('Lo' in gen_trade_codes(planet))
Пример #19
0
 def test_lo(self):
     '''Test Lo'''
     for pop in '123':
         planet = Planet()
         planet.population = uwp.Population(pop)
         self.assertTrue('Lo' in gen_trade_codes(planet))
Пример #20
0
 def test_not_ph(self):
     '''Test !Ph'''
     for pop in '012345679ABCDEF':
         planet = Planet()
         planet.population = uwp.Population(pop)
         self.assertFalse('Ph' in gen_trade_codes(planet))
Пример #21
0
 def test_ph(self):
     '''Test Ph'''
     pop = 8
     planet = Planet()
     planet.population = uwp.Population(pop)
     self.assertTrue('Ph' in gen_trade_codes(planet))