Skip to content

Commit 5ca3e11

Browse files
committed
Make hour12 property private (_hour12)
1 parent f0acee4 commit 5ca3e11

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

jdatetime/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
'%f': ('_strftime_get_attr_value', {'attr': 'microsecond', 'fmt': '%06.d', 'fb': '000000'}),
4646
'%H': ('_strftime_get_attr_value', {'attr': 'hour', 'fmt': '%02.d', 'fb': '00'}),
4747
'%-H': ('_strftime_get_attr_value', {'attr': 'hour', 'fmt': '%d', 'fb': '0'}),
48-
'%I': ('_strftime_get_attr_value', {'attr': 'hour12', 'fmt': '%02.d', 'fb': '12'}),
49-
'%-I': ('_strftime_get_attr_value', {'attr': 'hour12', 'fmt': '%d', 'fb': '12'}),
48+
'%I': ('_strftime_get_attr_value', {'attr': '_hour12', 'fmt': '%02.d', 'fb': '12'}),
49+
'%-I': ('_strftime_get_attr_value', {'attr': '_hour12', 'fmt': '%d', 'fb': '12'}),
5050
'%M': ('_strftime_get_attr_value', {'attr': 'minute', 'fmt': '%02.d', 'fb': '00'}),
5151
'%-M': ('_strftime_get_attr_value', {'attr': 'minute', 'fmt': '%d', 'fb': '0'}),
5252
'%S': ('_strftime_get_attr_value', {'attr': 'second', 'fmt': '%02.d', 'fb': '00'}),
@@ -872,7 +872,7 @@ def hour(self) -> int:
872872
return self.__time.hour
873873

874874
@property
875-
def hour12(self) -> int:
875+
def _hour12(self) -> int:
876876
"""Return the hour on a 12-hour clock (1..12), used by the %I directive."""
877877
hour = self.hour % 12
878878
return 12 if hour == 0 else hour

tests/test_jdatetime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def test_strftime_I_directive_uses_twelve_hour_clock(self):
221221
std = _std.datetime(2020, 1, 1, hour, 5, 0)
222222
self.assertEqual(jd.strftime('%I'), std.strftime('%I'))
223223
self.assertEqual(jd.strftime('%-I'), std.strftime('%-I'))
224-
self.assertEqual(jd.hour12, int(std.strftime('%I')))
224+
self.assertEqual(jd._hour12, int(std.strftime('%I')))
225225
# %I must be consistent with the (correct) %p directive:
226226
# reconstructing the 24-hour value from (%p, %I) round-trips.
227227
twelve = int(jd.strftime('%I'))

0 commit comments

Comments
 (0)