Esempio n. 1
0
    def test_format_timeframe(self):
        locale = locales.SpanishLocale()
        self.assertEqual(locale._format_timeframe("now", 0), "ahora")
        self.assertEqual(locale._format_timeframe("seconds", 1), "1 segundos")
        self.assertEqual(locale._format_timeframe("seconds", 3), "3 segundos")
        self.assertEqual(locale._format_timeframe("seconds", 30),
                         "30 segundos")
        self.assertEqual(locale._format_timeframe("minute", 1), "un minuto")
        self.assertEqual(locale._format_timeframe("minutes", 4), "4 minutos")
        self.assertEqual(locale._format_timeframe("minutes", 40), "40 minutos")
        self.assertEqual(locale._format_timeframe("hour", 1), "una hora")
        self.assertEqual(locale._format_timeframe("hours", 5), "5 horas")
        self.assertEqual(locale._format_timeframe("hours", 23), "23 horas")
        self.assertEqual(locale._format_timeframe("day", 1), "un día")
        self.assertEqual(locale._format_timeframe("days", 6), "6 días")
        self.assertEqual(locale._format_timeframe("days", 12), "12 días")
        self.assertEqual(locale._format_timeframe("week", 1), "una semana")
        self.assertEqual(locale._format_timeframe("weeks", 2), "2 semanas")
        self.assertEqual(locale._format_timeframe("weeks", 3), "3 semanas")
        self.assertEqual(locale._format_timeframe("month", 1), "un mes")
        self.assertEqual(locale._format_timeframe("months", 7), "7 meses")
        self.assertEqual(locale._format_timeframe("months", 11), "11 meses")
        self.assertEqual(locale._format_timeframe("year", 1), "un año")
        self.assertEqual(locale._format_timeframe("years", 8), "8 años")
        self.assertEqual(locale._format_timeframe("years", 12), "12 años")

        self.assertEqual(locale._format_timeframe("now", 0), "ahora")
        self.assertEqual(locale._format_timeframe("seconds", -1), "1 segundos")
        self.assertEqual(locale._format_timeframe("seconds", -9), "9 segundos")
        self.assertEqual(locale._format_timeframe("seconds", -12),
                         "12 segundos")
        self.assertEqual(locale._format_timeframe("minute", -1), "un minuto")
        self.assertEqual(locale._format_timeframe("minutes", -2), "2 minutos")
        self.assertEqual(locale._format_timeframe("minutes", -10),
                         "10 minutos")
        self.assertEqual(locale._format_timeframe("hour", -1), "una hora")
        self.assertEqual(locale._format_timeframe("hours", -3), "3 horas")
        self.assertEqual(locale._format_timeframe("hours", -11), "11 horas")
        self.assertEqual(locale._format_timeframe("day", -1), "un día")
        self.assertEqual(locale._format_timeframe("days", -2), "2 días")
        self.assertEqual(locale._format_timeframe("days", -12), "12 días")
        self.assertEqual(locale._format_timeframe("week", -1), "una semana")
        self.assertEqual(locale._format_timeframe("weeks", -2), "2 semanas")
        self.assertEqual(locale._format_timeframe("weeks", -3), "3 semanas")
        self.assertEqual(locale._format_timeframe("month", -1), "un mes")
        self.assertEqual(locale._format_timeframe("months", -3), "3 meses")
        self.assertEqual(locale._format_timeframe("months", -13), "13 meses")
        self.assertEqual(locale._format_timeframe("year", -1), "un año")
        self.assertEqual(locale._format_timeframe("years", -4), "4 años")
        self.assertEqual(locale._format_timeframe("years", -14), "14 años")
Esempio n. 2
0
    def test_format_timeframe(self):
        locale = locales.SpanishLocale()
        assert locale._format_timeframe("now", 0) == "ahora"
        assert locale._format_timeframe("seconds", 1) == "1 segundos"
        assert locale._format_timeframe("seconds", 3) == "3 segundos"
        assert locale._format_timeframe("seconds", 30) == "30 segundos"
        assert locale._format_timeframe("minute", 1) == "un minuto"
        assert locale._format_timeframe("minutes", 4) == "4 minutos"
        assert locale._format_timeframe("minutes", 40) == "40 minutos"
        assert locale._format_timeframe("hour", 1) == "una hora"
        assert locale._format_timeframe("hours", 5) == "5 horas"
        assert locale._format_timeframe("hours", 23) == "23 horas"
        assert locale._format_timeframe("day", 1) == "un día"
        assert locale._format_timeframe("days", 6) == "6 días"
        assert locale._format_timeframe("days", 12) == "12 días"
        assert locale._format_timeframe("week", 1) == "una semana"
        assert locale._format_timeframe("weeks", 2) == "2 semanas"
        assert locale._format_timeframe("weeks", 3) == "3 semanas"
        assert locale._format_timeframe("month", 1) == "un mes"
        assert locale._format_timeframe("months", 7) == "7 meses"
        assert locale._format_timeframe("months", 11) == "11 meses"
        assert locale._format_timeframe("year", 1) == "un año"
        assert locale._format_timeframe("years", 8) == "8 años"
        assert locale._format_timeframe("years", 12) == "12 años"

        assert locale._format_timeframe("now", 0) == "ahora"
        assert locale._format_timeframe("seconds", -1) == "1 segundos"
        assert locale._format_timeframe("seconds", -9) == "9 segundos"
        assert locale._format_timeframe("seconds", -12) == "12 segundos"
        assert locale._format_timeframe("minute", -1) == "un minuto"
        assert locale._format_timeframe("minutes", -2) == "2 minutos"
        assert locale._format_timeframe("minutes", -10) == "10 minutos"
        assert locale._format_timeframe("hour", -1) == "una hora"
        assert locale._format_timeframe("hours", -3) == "3 horas"
        assert locale._format_timeframe("hours", -11) == "11 horas"
        assert locale._format_timeframe("day", -1) == "un día"
        assert locale._format_timeframe("days", -2) == "2 días"
        assert locale._format_timeframe("days", -12) == "12 días"
        assert locale._format_timeframe("week", -1) == "una semana"
        assert locale._format_timeframe("weeks", -2) == "2 semanas"
        assert locale._format_timeframe("weeks", -3) == "3 semanas"
        assert locale._format_timeframe("month", -1) == "un mes"
        assert locale._format_timeframe("months", -3) == "3 meses"
        assert locale._format_timeframe("months", -13) == "13 meses"
        assert locale._format_timeframe("year", -1) == "un año"
        assert locale._format_timeframe("years", -4) == "4 años"
        assert locale._format_timeframe("years", -14) == "14 años"
Esempio n. 3
0
    def test_ordinal_number(self):
        locale = locales.SpanishLocale()

        assertEqual(locale.ordinal_number(1), '1°')
Esempio n. 4
0
    def test_ordinal_number(self):
        locale = locales.SpanishLocale()

        assert locale.ordinal_number(1) == "1º"