Skip to content

Commit 025ab67

Browse files
committed
Try to address ci issues
1 parent 76b6636 commit 025ab67

File tree

3 files changed

+34
-40
lines changed

3 files changed

+34
-40
lines changed

pandas/_libs/tslibs/timestamps.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ class Timestamp(_Timestamp):
734734
"""
735735
warnings.warn("`weekday_name` is deprecated and will be removed in a "
736736
"future version. Use `day_name` instead",
737-
DeprecationWarning, stacklevel=3)
737+
DeprecationWarning)
738738
cdef dict wdays = {0: 'Monday', 1: 'Tuesday', 2: 'Wednesday',
739739
3: 'Thursday', 4: 'Friday', 5: 'Saturday',
740740
6: 'Sunday'}

pandas/tests/indexes/datetimes/test_misc.py

+27-26
Original file line numberDiff line numberDiff line change
@@ -332,33 +332,34 @@ def test_datetimeindex_accessors(self):
332332
@pytest.mark.parametrize('time_locale', tm.get_locales() + [None])
333333
def test_datetime_name_accessors(self, time_locale):
334334
with tm.set_locale(time_locale, locale.LC_TIME):
335-
# GH 11128
336-
dti = DatetimeIndex(freq='D', start=datetime(1998, 1, 1),
337-
periods=365)
338-
english_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday',
339-
'Friday', 'Saturday', 'Sunday']
340-
for day, name, eng_name in zip(range(4, 11),
341-
calendar.day_name,
342-
english_days):
343-
# Test Monday -> Sunday
344-
name = name.capitalize()
345-
assert dti.weekday_name[day] == eng_name
346-
assert dti.day_name(time_locale=time_locale)[day] == name
347-
ts = Timestamp(datetime(2016, 4, day))
348-
assert ts.weekday_name == eng_name
349-
assert ts.day_name(time_locale=time_locale) == name
350-
351-
with tm.set_locale(time_locale, locale.LC_TIME):
352-
# GH 12805
353-
dti = DatetimeIndex(freq='M', start='2012', end='2013')
335+
expected_days = calendar.day_name[:]
354336
expected_months = calendar.month_name[1:]
355-
# Test January -> December
356-
result = dti.month_name(time_locale=time_locale)
357-
expected = Index([month.capitalize() for month in expected_months])
358-
tm.assert_index_equal(result, expected)
359-
for date, expected in zip(dti, expected_months):
360-
result = date.month_name(time_locale=time_locale)
361-
assert result == expected.capitalize()
337+
338+
# GH 11128
339+
dti = DatetimeIndex(freq='D', start=datetime(1998, 1, 1),
340+
periods=365)
341+
english_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday',
342+
'Friday', 'Saturday', 'Sunday']
343+
for day, name, eng_name in zip(range(4, 11),
344+
expected_days,
345+
english_days):
346+
# Test Monday -> Sunday
347+
name = name.capitalize()
348+
assert dti.weekday_name[day] == eng_name
349+
assert dti.day_name(time_locale=time_locale)[day] == name
350+
ts = Timestamp(datetime(2016, 4, day))
351+
assert ts.weekday_name == eng_name
352+
assert ts.day_name(time_locale=time_locale) == name
353+
354+
# GH 12805
355+
dti = DatetimeIndex(freq='M', start='2012', end='2013')
356+
# Test January -> December
357+
result = dti.month_name(time_locale=time_locale)
358+
expected = Index([month.capitalize() for month in expected_months])
359+
tm.assert_index_equal(result, expected)
360+
for date, expected in zip(dti, expected_months):
361+
result = date.month_name(time_locale=time_locale)
362+
assert result == expected.capitalize()
362363

363364
def test_nanosecond_field(self):
364365
dti = DatetimeIndex(np.arange(10))

pandas/tests/scalar/test_timestamp.py

+6-13
Original file line numberDiff line numberDiff line change
@@ -632,19 +632,12 @@ def test_names(self, data, time_locale):
632632
with tm.assert_produces_warning(DeprecationWarning,
633633
check_stacklevel=False):
634634
assert data.weekday_name == 'Monday'
635-
if time_locale is None:
636-
assert data.day_name(time_locale) == 'Monday'
637-
assert data.month_name(time_locale) == 'August'
638-
else:
639-
with tm.set_locale(time_locale, locale.LC_TIME):
640-
expected = calendar.day_name[0].capitalize()
641-
result = data.day_name(time_locale)
642-
assert result == expected
643-
644-
with tm.set_locale(time_locale, locale.LC_TIME):
645-
expected = calendar.month_name[8].capitalize()
646-
result = data.month_name(time_locale)
647-
assert result == expected
635+
with tm.set_locale(time_locale, locale.LC_TIME):
636+
expected_day = calendar.day_name[0].capitalize()
637+
expected_month = calendar.month_name[8].capitalize()
638+
639+
assert data.day_name(time_locale) == expected_day
640+
assert data.month_name(time_locale) == expected_month
648641

649642
def test_pprint(self):
650643
# GH12622

0 commit comments

Comments
 (0)