MCPcopy Index your code
hub / github.com/python/cpython / _update_variables

Method _update_variables

Lib/test/test_strftime.py:34–68  ·  view source on GitHub ↗
(self, now)

Source from the content-addressed store, hash-verified

32class StrftimeTest(unittest.TestCase):
33
34 def _update_variables(self, now):
35 # we must update the local variables on every cycle
36 self.gmt = time.gmtime(now)
37 now = time.localtime(now)
38
39 if now[3] < 12: self.ampm='(AM|am)'
40 else: self.ampm='(PM|pm)'
41
42 jan1 = time.struct_time(
43 (
44 now.tm_year, # Year
45 1, # Month (January)
46 1, # Day (1st)
47 0, # Hour (0)
48 0, # Minute (0)
49 0, # Second (0)
50 -1, # tm_wday (will be determined)
51 1, # tm_yday (day 1 of the year)
52 -1, # tm_isdst (let the system determine)
53 )
54 )
55 # use mktime to get the correct tm_wday and tm_isdst values
56 self.jan1 = time.localtime(time.mktime(jan1))
57
58 try:
59 if now[8]: self.tz = time.tzname[1]
60 else: self.tz = time.tzname[0]
61 except AttributeError:
62 self.tz = ''
63
64 if now[3] > 12: self.clock12 = now[3] - 12
65 elif now[3] > 0: self.clock12 = now[3]
66 else: self.clock12 = 12
67
68 self.now = now
69
70 def setUp(self):
71 from locale import setlocale, LC_TIME

Callers 1

test_strftimeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected