Skip to content

Commit

Permalink
Try to address ci issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Jan 14, 2018
1 parent 76b6636 commit 025ab67
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 40 deletions.
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ class Timestamp(_Timestamp):
"""
warnings.warn("`weekday_name` is deprecated and will be removed in a "
"future version. Use `day_name` instead",
DeprecationWarning, stacklevel=3)
DeprecationWarning)
cdef dict wdays = {0: 'Monday', 1: 'Tuesday', 2: 'Wednesday',
3: 'Thursday', 4: 'Friday', 5: 'Saturday',
6: 'Sunday'}
Expand Down
53 changes: 27 additions & 26 deletions pandas/tests/indexes/datetimes/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,33 +332,34 @@ def test_datetimeindex_accessors(self):
@pytest.mark.parametrize('time_locale', tm.get_locales() + [None])
def test_datetime_name_accessors(self, time_locale):
with tm.set_locale(time_locale, locale.LC_TIME):
# GH 11128
dti = DatetimeIndex(freq='D', start=datetime(1998, 1, 1),
periods=365)
english_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday', 'Sunday']
for day, name, eng_name in zip(range(4, 11),
calendar.day_name,
english_days):
# Test Monday -> Sunday
name = name.capitalize()
assert dti.weekday_name[day] == eng_name
assert dti.day_name(time_locale=time_locale)[day] == name
ts = Timestamp(datetime(2016, 4, day))
assert ts.weekday_name == eng_name
assert ts.day_name(time_locale=time_locale) == name

with tm.set_locale(time_locale, locale.LC_TIME):
# GH 12805
dti = DatetimeIndex(freq='M', start='2012', end='2013')
expected_days = calendar.day_name[:]
expected_months = calendar.month_name[1:]
# Test January -> December
result = dti.month_name(time_locale=time_locale)
expected = Index([month.capitalize() for month in expected_months])
tm.assert_index_equal(result, expected)
for date, expected in zip(dti, expected_months):
result = date.month_name(time_locale=time_locale)
assert result == expected.capitalize()

# GH 11128
dti = DatetimeIndex(freq='D', start=datetime(1998, 1, 1),
periods=365)
english_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday',
'Friday', 'Saturday', 'Sunday']
for day, name, eng_name in zip(range(4, 11),
expected_days,
english_days):
# Test Monday -> Sunday
name = name.capitalize()
assert dti.weekday_name[day] == eng_name
assert dti.day_name(time_locale=time_locale)[day] == name
ts = Timestamp(datetime(2016, 4, day))
assert ts.weekday_name == eng_name
assert ts.day_name(time_locale=time_locale) == name

# GH 12805
dti = DatetimeIndex(freq='M', start='2012', end='2013')
# Test January -> December
result = dti.month_name(time_locale=time_locale)
expected = Index([month.capitalize() for month in expected_months])
tm.assert_index_equal(result, expected)
for date, expected in zip(dti, expected_months):
result = date.month_name(time_locale=time_locale)
assert result == expected.capitalize()

def test_nanosecond_field(self):
dti = DatetimeIndex(np.arange(10))
Expand Down
19 changes: 6 additions & 13 deletions pandas/tests/scalar/test_timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,19 +632,12 @@ def test_names(self, data, time_locale):
with tm.assert_produces_warning(DeprecationWarning,
check_stacklevel=False):
assert data.weekday_name == 'Monday'
if time_locale is None:
assert data.day_name(time_locale) == 'Monday'
assert data.month_name(time_locale) == 'August'
else:
with tm.set_locale(time_locale, locale.LC_TIME):
expected = calendar.day_name[0].capitalize()
result = data.day_name(time_locale)
assert result == expected

with tm.set_locale(time_locale, locale.LC_TIME):
expected = calendar.month_name[8].capitalize()
result = data.month_name(time_locale)
assert result == expected
with tm.set_locale(time_locale, locale.LC_TIME):
expected_day = calendar.day_name[0].capitalize()
expected_month = calendar.month_name[8].capitalize()

assert data.day_name(time_locale) == expected_day
assert data.month_name(time_locale) == expected_month

def test_pprint(self):
# GH12622
Expand Down

0 comments on commit 025ab67

Please sign in to comment.