Skip to content

CLN: Deprecation of assert_ #7172

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 2 commits into from
May 19, 2014
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
12 changes: 6 additions & 6 deletions pandas/io/tests/test_packers.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ def test_dict_float(self):
def test_dict_complex(self):
x = {'foo': 1.0 + 1.0j, 'bar': 2.0 + 2.0j}
x_rec = self.encode_decode(x)
self.assert_(all(map(lambda x, y: x == y, x.values(), x_rec.values())) and
all(map(lambda x, y: type(x) == type(y), x.values(), x_rec.values())))
self.assertTrue(all(map(lambda x, y: x == y, x.values(), x_rec.values())) and
all(map(lambda x, y: type(x) == type(y), x.values(), x_rec.values())))

def test_dict_numpy_float(self):
x = {'foo': np.float32(1.0), 'bar': np.float32(2.0)}
Expand All @@ -161,8 +161,8 @@ def test_dict_numpy_complex(self):
x = {'foo': np.complex128(
1.0 + 1.0j), 'bar': np.complex128(2.0 + 2.0j)}
x_rec = self.encode_decode(x)
self.assert_(all(map(lambda x, y: x == y, x.values(), x_rec.values())) and
all(map(lambda x, y: type(x) == type(y), x.values(), x_rec.values())))
self.assertTrue(all(map(lambda x, y: x == y, x.values(), x_rec.values())) and
all(map(lambda x, y: type(x) == type(y), x.values(), x_rec.values())))


def test_numpy_array_float(self):
Expand All @@ -178,8 +178,8 @@ def test_numpy_array_float(self):
def test_numpy_array_complex(self):
x = (np.random.rand(5) + 1j * np.random.rand(5)).astype(np.complex128)
x_rec = self.encode_decode(x)
self.assert_(all(map(lambda x, y: x == y, x, x_rec)) and
x.dtype == x_rec.dtype)
self.assertTrue(all(map(lambda x, y: x == y, x, x_rec)) and
x.dtype == x_rec.dtype)

def test_list_mixed(self):
x = [1.0, np.float32(3.5), np.complex128(4.25), u('foo')]
Expand Down
8 changes: 4 additions & 4 deletions pandas/io/tests/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ def test_keys(self):
store['d'] = tm.makePanel()
store['foo/bar'] = tm.makePanel()
self.assertEqual(len(store), 5)
self.assert_(set(
store.keys()) == set(['/a', '/b', '/c', '/d', '/foo/bar']))
self.assertTrue(set(
store.keys()) == set(['/a', '/b', '/c', '/d', '/foo/bar']))

def test_repr(self):

Expand Down Expand Up @@ -1077,8 +1077,8 @@ def test_ndim_indexables(self):

def check_indexers(key, indexers):
for i, idx in enumerate(indexers):
self.assert_(getattr(getattr(
store.root, key).table.description, idx)._v_pos == i)
self.assertTrue(getattr(getattr(
store.root, key).table.description, idx)._v_pos == i)

# append then change (will take existing schema)
indexers = ['items', 'major_axis', 'minor_axis']
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,8 +1382,8 @@ def test_to_string(self):
header=None, sep=' ')
tm.assert_series_equal(recons['B'], biggie['B'])
self.assertEqual(recons['A'].count(), biggie['A'].count())
self.assert_((np.abs(recons['A'].dropna() -
biggie['A'].dropna()) < 0.1).all())
self.assertTrue((np.abs(recons['A'].dropna() -
biggie['A'].dropna()) < 0.1).all())

# expected = ['B', 'A']
# self.assertEqual(header, expected)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,8 +1601,8 @@ def test_get_set_value_no_partial_indexing(self):

def test_single_element_ix_dont_upcast(self):
self.frame['E'] = 1
self.assert_(issubclass(self.frame['E'].dtype.type,
(int, np.integer)))
self.assertTrue(issubclass(self.frame['E'].dtype.type,
(int, np.integer)))

result = self.frame.ix[self.frame.index[5], 'E']
self.assertTrue(com.is_integer(result))
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/test_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,8 @@ def test_apply(self):

# ufunc
applied = self.panel.apply(np.sqrt)
self.assert_(assert_almost_equal(applied.values,
np.sqrt(self.panel.values)))
self.assertTrue(assert_almost_equal(applied.values,
np.sqrt(self.panel.values)))

# ufunc same shape
result = self.panel.apply(lambda x: x*2, axis='items')
Expand Down
36 changes: 18 additions & 18 deletions pandas/tseries/tests/test_frequencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,31 +217,31 @@ def _check_generated_range(self, start, freq):
self.assertEqual(infer_freq(index), gen.freqstr)
else:
inf_freq = infer_freq(index)
self.assert_((inf_freq == 'Q-DEC' and
gen.freqstr in ('Q', 'Q-DEC', 'Q-SEP', 'Q-JUN',
'Q-MAR'))
or
(inf_freq == 'Q-NOV' and
gen.freqstr in ('Q-NOV', 'Q-AUG', 'Q-MAY', 'Q-FEB'))
or
(inf_freq == 'Q-OCT' and
gen.freqstr in ('Q-OCT', 'Q-JUL', 'Q-APR', 'Q-JAN')))
self.assertTrue((inf_freq == 'Q-DEC' and
gen.freqstr in ('Q', 'Q-DEC', 'Q-SEP', 'Q-JUN',
'Q-MAR'))
or
(inf_freq == 'Q-NOV' and
gen.freqstr in ('Q-NOV', 'Q-AUG', 'Q-MAY', 'Q-FEB'))
or
(inf_freq == 'Q-OCT' and
gen.freqstr in ('Q-OCT', 'Q-JUL', 'Q-APR', 'Q-JAN')))

gen = date_range(start, periods=5, freq=freq)
index = _dti(gen.values)
if not freq.startswith('Q-'):
self.assertEqual(infer_freq(index), gen.freqstr)
else:
inf_freq = infer_freq(index)
self.assert_((inf_freq == 'Q-DEC' and
gen.freqstr in ('Q', 'Q-DEC', 'Q-SEP', 'Q-JUN',
'Q-MAR'))
or
(inf_freq == 'Q-NOV' and
gen.freqstr in ('Q-NOV', 'Q-AUG', 'Q-MAY', 'Q-FEB'))
or
(inf_freq == 'Q-OCT' and
gen.freqstr in ('Q-OCT', 'Q-JUL', 'Q-APR', 'Q-JAN')))
self.assertTrue((inf_freq == 'Q-DEC' and
gen.freqstr in ('Q', 'Q-DEC', 'Q-SEP', 'Q-JUN',
'Q-MAR'))
or
(inf_freq == 'Q-NOV' and
gen.freqstr in ('Q-NOV', 'Q-AUG', 'Q-MAY', 'Q-FEB'))
or
(inf_freq == 'Q-OCT' and
gen.freqstr in ('Q-OCT', 'Q-JUL', 'Q-APR', 'Q-JAN')))

def test_infer_freq(self):
rng = period_range('1959Q2', '2009Q3', freq='Q')
Expand Down
4 changes: 2 additions & 2 deletions pandas/tseries/tests/test_timezones.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ def test_append_aware_naive(self):
ts1 = Series(np.random.randn(len(rng1)), index=rng1)
ts2 = Series(np.random.randn(len(rng2)), index=rng2)
ts_result = ts1.append(ts2)
self.assert_(ts_result.index.equals(
self.assertTrue(ts_result.index.equals(
ts1.index.asobject.append(ts2.index.asobject)))

# mixed
Expand All @@ -850,7 +850,7 @@ def test_append_aware_naive(self):
ts1 = Series(np.random.randn(len(rng1)), index=rng1)
ts2 = Series(np.random.randn(len(rng2)), index=rng2)
ts_result = ts1.append(ts2)
self.assert_(ts_result.index.equals(
self.assertTrue(ts_result.index.equals(
ts1.index.asobject.append(ts2.index)))

def test_equal_join_ensure_utc(self):
Expand Down
2 changes: 1 addition & 1 deletion pandas/tseries/tests/test_tslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test_coercing_dates_outside_of_datetime64_ns_bounds(self):
coerce=False,
raise_=True,
)
self.assert_(
self.assertTrue(
np.array_equal(
tslib.array_to_datetime(
np.array([invalid_date], dtype='object'), coerce=True
Expand Down