MCPcopy
hub / github.com/django/django / test_different_timezones

Method test_different_timezones

tests/utils_tests/test_timesince.py:125–138  ·  view source on GitHub ↗

When using two different timezones.

(self)

Source from the content-addressed store, hash-verified

123
124 @requires_tz_support
125 def test_different_timezones(self):
126 """When using two different timezones."""
127 now = datetime.datetime.now()
128 now_tz = timezone.make_aware(now, timezone.get_default_timezone())
129 now_tz_i = timezone.localtime(now_tz, timezone.get_fixed_timezone(195))
130
131 self.assertEqual(timesince(now), "0\xa0minutes")
132 self.assertEqual(timesince(now_tz), "0\xa0minutes")
133 self.assertEqual(timesince(now_tz_i), "0\xa0minutes")
134 self.assertEqual(timesince(now_tz, now_tz_i), "0\xa0minutes")
135 self.assertEqual(timeuntil(now), "0\xa0minutes")
136 self.assertEqual(timeuntil(now_tz), "0\xa0minutes")
137 self.assertEqual(timeuntil(now_tz_i), "0\xa0minutes")
138 self.assertEqual(timeuntil(now_tz, now_tz_i), "0\xa0minutes")
139
140 def test_date_objects(self):
141 """

Callers

nothing calls this directly

Calls 3

timesinceFunction · 0.90
timeuntilFunction · 0.90
nowMethod · 0.45

Tested by

no test coverage detected