Skip to content

Separate non-scalar tests from test_timestamps #19385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pandas/tests/frame/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,16 @@ def test_applymap(self):
result = frame.applymap(func)
tm.assert_frame_equal(result, frame)

def test_applymap_box_timestamps(self):
# #2689, #2627
ser = pd.Series(date_range('1/1/2000', periods=10))

def func(x):
return (x.hour, x.day, x.month)

# it works!
pd.DataFrame(ser).applymap(func)

def test_applymap_box(self):
# ufunc will not be boxed. Same test cases as the test_map_box
df = pd.DataFrame({'a': [pd.Timestamp('2011-01-01'),
Expand Down
19 changes: 19 additions & 0 deletions pandas/tests/indexes/datetimes/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,25 @@ def test_numpy_minmax(self):
tm.assert_raises_regex(
ValueError, errmsg, np.argmax, dr, out=0)

def test_round_daily(self):
dti = pd.date_range('20130101 09:10:11', periods=5)
result = dti.round('D')
expected = pd.date_range('20130101', periods=5)
tm.assert_index_equal(result, expected)

dti = dti.tz_localize('UTC').tz_convert('US/Eastern')
result = dti.round('D')
expected = pd.date_range('20130101',
periods=5).tz_localize('US/Eastern')
tm.assert_index_equal(result, expected)

result = dti.round('s')
tm.assert_index_equal(result, dti)

# invalid
for freq in ['Y', 'M', 'foobar']:
pytest.raises(ValueError, lambda: dti.round(freq))

def test_round(self):
for tz in self.tz:
rng = pd.date_range(start='2016-01-01', periods=5,
Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/io/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,13 @@ def test_fallback_success(self):
banklist_data = os.path.join(DATA_PATH, 'banklist.html')
self.read_html(banklist_data, '.*Water.*', flavor=['lxml', 'html5lib'])

def test_to_html_timestamp(self):
rng = date_range('2000-01-01', periods=10)
df = DataFrame(np.random.randn(10, 4), index=rng)

result = df.to_html()
assert '2000-01-01' in result

def test_parse_dates_list(self):
df = DataFrame({'date': date_range('1/1/2001', periods=10)})
expected = df.to_html()
Expand Down
Loading