import pytest

from meteoflow.exceptions import ValidationError
from meteoflow.options import validate_days, validate_lang, validate_units


def test_validate_days_ok():
    validate_days(1)
    validate_days("2")
    validate_days(None)


def test_validate_days_invalid():
    with pytest.raises(ValidationError):
        validate_days(0)
    with pytest.raises(ValidationError):
        validate_days("bad")


def test_validate_units_ok():
    validate_units("metric")
    validate_units("imperial")
    validate_units(None)


def test_validate_units_invalid():
    with pytest.raises(ValidationError):
        validate_units("si")


def test_validate_lang_ok():
    validate_lang("en")
    validate_lang(None)


def test_validate_lang_invalid():
    with pytest.raises(ValidationError):
        validate_lang(123)
