def test_suck_report_freezing_windy(cls):
     weather = Weather(clouds=100,
                       dt=0,
                       humidity=0,
                       rain=0,
                       temp=Temp(min=-10, max=-5),
                       wind=Wind(speed=20, deg=270))
     score = SuckReport.create(weather, 90).total
     assert is_approximately(score, 18)
 def test_suck_report_incredible(cls):
     weather = Weather(clouds=0,
                       dt=0,
                       humidity=0,
                       rain=0,
                       temp=Temp(min=18, max=22),
                       wind=Wind(speed=10, deg=90))
     score = SuckReport.create(weather, 90).total
     assert is_approximately(score, -1, delta=1)
 def test_suck_report_ideal_rainy(cls):
     weather = Weather(clouds=100,
                       dt=0,
                       humidity=0,
                       rain=1.5,
                       temp=Temp(min=18, max=22),
                       wind=Wind(speed=0, deg=90))
     score = SuckReport.create(weather, 90).total
     assert is_approximately(score, 12)
 def test_suck_report_hot_humid_rainy(cls):
     weather = Weather(clouds=100,
                       dt=0,
                       humidity=100,
                       rain=2,
                       temp=Temp(min=30, max=35),
                       wind=Wind(speed=0, deg=90))
     score = SuckReport.create(weather, 90).total
     assert is_approximately(score, 20)
    def test_suck_report_wind_direction(cls):
        weather = Weather(clouds=50,
                          dt=0,
                          humidity=60,
                          rain=1.4,
                          temp=Temp(min=20, max=30),
                          wind=Wind(speed=40, deg=90))

        def calc(travel_direction):
            return SuckReport.create(weather, travel_direction).total

        assert is_approximately(calc(90), 10)
        assert calc(60) > calc(90)
        assert calc(180) > calc(60)
        assert calc(0) == calc(180)
        assert calc(240) > calc(180)
        assert calc(270) > calc(240)
Example #6
0
 def test_get_weather_at_time_late(cls, weather_data):
     time = datetime.fromtimestamp(1550330000)
     weather = Weather.get_weather_at_time(weather_data, time)
     assert weather.dt == 1550329200
Example #7
0
 def test_get_weather_at_time_exact(cls, weather_data):
     time = datetime.fromtimestamp(1550296800)
     weather = Weather.get_weather_at_time(weather_data, time)
     assert weather.dt == 1550296800