Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
super(SlovakLocaleTests, self).setUp()
self.locale = locales.SlovakLocale()
def setUp(self):
super(BengaliLocaleTests, self).setUp()
self.locale = locales.BengaliLocale()
def test_couple_of_timeframe(self):
locale = locales.HebrewLocale()
self.assertEqual(locale._format_timeframe("hours", 2), "שעתיים")
self.assertEqual(locale._format_timeframe("months", 2), "חודשיים")
self.assertEqual(locale._format_timeframe("days", 2), "יומיים")
self.assertEqual(locale._format_timeframe("years", 2), "שנתיים")
self.assertEqual(locale._format_timeframe("hours", 3), "3 שעות")
self.assertEqual(locale._format_timeframe("months", 4), "4 חודשים")
self.assertEqual(locale._format_timeframe("days", 3), "3 ימים")
self.assertEqual(locale._format_timeframe("years", 5), "5 שנים")
def setUp(self):
super(CzechLocaleTests, self).setUp()
self.locale = locales.CzechLocale()
def setUp(self):
super(EsperantoLocaleTests, self).setUp()
self.locale = locales.EsperantoLocale()
:param locale: (optional) a ``str`` specifying a locale. Defaults to 'en_us'.
:param only_distance: (optional) returns only time difference eg: "11 seconds" without "in" or "ago" part.
Usage::
>>> earlier = arrow.utcnow().replace(hours=-2)
>>> earlier.humanize()
'2 hours ago'
>>> later = later = earlier.replace(hours=4)
>>> later.humanize(earlier)
'in 4 hours'
'''
locale = locales.get_locale(locale)
if other is None:
utc = datetime.utcnow().replace(tzinfo=dateutil_tz.tzutc())
dt = utc.astimezone(self._datetime.tzinfo)
elif isinstance(other, Arrow):
dt = other._datetime
elif isinstance(other, datetime):
if other.tzinfo is None:
dt = other.replace(tzinfo=self._datetime.tzinfo)
else:
dt = other.astimezone(self._datetime.tzinfo)
else:
raise TypeError()
def fix():
# insert a modified function so if there is no language available in arrow, returns English locale.
locales.get_locale = get_locale
def locale():
return arrow.locales.get_locale('en_us')