def test_field(self): for t in (EorzeaTime.weather_period(10)): weather = EorzeaWeather.forecast('Eureka Pyros', t) assert isinstance(weather, str) with pytest.raises(KeyError): pyros_weather = EorzeaWeather.forecast('EuPyros', 1542591400.045)
def test_field(self): weathers = EorzeaWeather.forecast('Eureka Pyros', EorzeaTime.weather_period(10)) for weather in weathers: assert isinstance(weather, str) with pytest.raises(ValueError): pyros_weather = EorzeaWeather.forecast('EuPyros', 1542591400.045)
def test_localize(self): assert EorzeaWeather.forecast('Eureka Pagos', 1542651599.999, lang='en') == 'Fog' assert EorzeaWeather.forecast('Eureka Pagos', 1542651599.999, lang='ja') == '霧' assert EorzeaWeather.forecast('Eureka Pagos', 1542651599.999, lang='de') == 'Neblig' assert EorzeaWeather.forecast('Eureka Pagos', 1542651599.999, lang='fr') == 'Brouillard'
def test_localize(self): assert EorzeaWeather.forecast('Eureka Pagos', 1542651599.999, lang=EorzeaLang.EN) == 'Fog' assert EorzeaWeather.forecast('Eureka Pagos', 1542651599.999, lang=EorzeaLang.JA) == '霧' assert EorzeaWeather.forecast('Eureka Pagos', 1542651599.999, lang=EorzeaLang.DE) == 'Neblig' assert EorzeaWeather.forecast('Eureka Pagos', 1542651599.999, lang=EorzeaLang.FR) == 'Brouillard'
async def on_message(self, msg): if not msg.author.bot: if msg.content.startswith('!4'): command = msg.content.split(' ') if command[1] == 'weather': etl = EorzeaTime.next_weather_period_start() try: island = self.island_list[command[2]] except KeyError as err: island = None print(repr(err)) results = [] if not island: return for time in etl: from_ = dt.fromtimestamp(time, tz=self.tw).strftime("%H:%M") weather = EorzeaWeather.forecast_weather( island, time).lower().replace(" ", "_") icon_id = discord.utils.find( lambda e: e.name == weather, msg.server.emojis).id result = '<:{}:{}> `{}~`'.format( weather, icon_id, from_) results.append(result) weather_transform = "\n".join(str(r) for r in results) await self.send_message(msg.channel, weather_transform)
def test_forecast(self): assert EorzeaWeather.forecast('Eureka Pagos', 1542651599.999) == 'Fog' assert EorzeaWeather.forecast('Eureka Pyros', 1542591400.045) == 'Umbral Wind' assert EorzeaWeather.forecast( 'Sigmascape V4.0', 1542591400.045) == 'Dimensional Disruption' assert EorzeaWeather.forecast('Bowl of Embers', 1542591400.045) == 'Heat Waves' assert EorzeaWeather.forecast('the ruby sea', 1542591400.045) == 'Fair Skies' assert EorzeaWeather.forecast('sea of clouds', 1542591400.045) == 'Fog' assert EorzeaWeather.forecast( 'asdfUpper aetheroacoustic exploratory sitea dsf', 1542591400.045, strict=False) == 'Fair Skies' assert EorzeaWeather.forecast('Eureka Hydatos', 1542591400.045) == 'Thunderstorms'