Ejemplo n.º 1
0
def test_wind_output():
    cur_wind = wind.Wind(0, 0)
    assert cur_wind.to_text() == "С 0.0 м/с"

    cur_wind = wind.Wind(10, 90)
    assert cur_wind.to_text() == "В 2.8 м/с"

    cur_wind = wind.Wind(7, 216)
    assert cur_wind.to_text() == "ЮЗ 1.9 м/с"

    cur_wind = wind.Wind(60, 301)
    assert cur_wind.to_text() == "СЗ 16.7 м/с"
Ejemplo n.º 2
0
    def to_text(self):
        # Преобразуем в текст для вывода
        self.parse()
        self.wind = wind.Wind(self.wind_kph, self.wind_dir)
        textPart = """%s
%s
%s
Температура: %d °C
Ощущается как: %d °C
Ветер: """ % (self.city, self.time, self.conditions, self.temp, self.feelslike)
        text = textPart + self.wind.to_text()
        return text
Ejemplo n.º 3
0
def test_mps_by_kph():
    cur_wind = wind.Wind(0, 0)
    assert cur_wind.get_mps_by_kph(7) == 1.9444460000000001
    assert cur_wind.get_mps_by_kph(10) == 2.7777800000000004
    assert cur_wind.get_mps_by_kph(60) == 16.666680000000003
Ejemplo n.º 4
0
def test_format_wind_mps():
    cur_wind = wind.Wind(0, 0)
    assert cur_wind.format_wind_mps(3.8888920000000002) == "3.9"
    assert cur_wind.format_wind_mps(1.9444460000000001) == "1.9"
    assert cur_wind.format_wind_mps(2.7777800000000004) == "2.8"
    assert cur_wind.format_wind_mps(16.666680000000003) == "16.7"
Ejemplo n.º 5
0
def check_wind_rhumbs(wd, rhumbs_expected):
    cur_wind = wind.Wind(1, wd)
    assert cur_wind.to_rhumbs() == rhumbs_expected