def generatecontinent(): """Generate a continent""" features = feature_filter('continent') continent = Continent(app.server, features) continent.add_countries() return render_template('continent.html', tempobj=continent)
def test_static_continents(self): """ """ continenta = Continent(self.redis) continentb = Continent(self.redis) planet = Planet(self.redis, {'continents': [continenta, continentb]}) planet.add_continents() self.assertNotEquals('Absobah', planet.name)
def test_static_continentcount(self): """ """ continenta = Continent(self.redis) continentb = Continent(self.redis) planet = Planet(self.redis, { 'continents': [continenta, continentb], 'continentcount': 4 }) self.assertEqual(len(planet.continents), 2) self.assertEqual(planet.continentcount, 2) planet.continentcount = 4 planet.add_continents() self.assertEqual(len(planet.continents), 4)
def test_continent_pass_countries(self): """ """ countrya = Country(self.redis) countryb = Country(self.redis) countryc = Country(self.redis) continent = Continent(self.redis, {'countries': [countrya, countryb, countryc]}) continent.add_countries() self.assertEqual(len(continent.countries), 3) self.assertIn(countrya, continent.countries) self.assertIn(countryb, continent.countries) self.assertIn(countryc, continent.countries) continent.countrycount = 5 continent.add_countries() self.assertEqual(len(continent.countries), 5) self.assertIn(countrya, continent.countries) self.assertIn(countryb, continent.countries) self.assertIn(countryc, continent.countries)
def test_continent_pass_countries(self): """ """ countrya=Country(self.redis) countryb=Country(self.redis) countryc=Country(self.redis) continent = Continent(self.redis, {'countries':[countrya,countryb,countryc] }) continent.add_countries() self.assertEqual(len(continent.countries), 3) self.assertIn(countrya,continent.countries) self.assertIn(countryb,continent.countries) self.assertIn(countryc,continent.countries) continent.countrycount=5 continent.add_countries() self.assertEqual(len(continent.countries), 5) self.assertIn(countrya,continent.countries) self.assertIn(countryb,continent.countries) self.assertIn(countryc,continent.countries)
def test_continent_str(self): continent = Continent(self.redis) self.assertEqual('West Asbarca', str(continent))
def test_continent_countryCount(self): """ """ continent = Continent(self.redis, {'countrycount': 25}) continent.add_countries() self.assertEqual(len(continent.countries), 25)
def test_random_continent(self): """ """ continent = Continent(self.redis) continent.add_countries() self.assertGreaterEqual(len(continent.countries), 0)