Skip to content

MAINT: Remove self.assertTrue from testing #16158

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
Apr 27, 2017
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
26 changes: 13 additions & 13 deletions pandas/tests/computation/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,17 +662,17 @@ def test_identical(self):
x = 1
result = pd.eval('x', engine=self.engine, parser=self.parser)
self.assertEqual(result, 1)
self.assertTrue(is_scalar(result))
assert is_scalar(result)

x = 1.5
result = pd.eval('x', engine=self.engine, parser=self.parser)
self.assertEqual(result, 1.5)
self.assertTrue(is_scalar(result))
assert is_scalar(result)

x = False
result = pd.eval('x', engine=self.engine, parser=self.parser)
self.assertEqual(result, False)
self.assertTrue(is_scalar(result))
assert is_scalar(result)

x = np.array([1])
result = pd.eval('x', engine=self.engine, parser=self.parser)
Expand Down Expand Up @@ -708,7 +708,7 @@ def test_float_truncation(self):
1000000000.0015]})
cutoff = 1000000000.0006
result = df.query("A < %.4f" % cutoff)
self.assertTrue(result.empty)
assert result.empty

cutoff = 1000000000.0010
result = df.query("A > %.4f" % cutoff)
Expand Down Expand Up @@ -1281,7 +1281,7 @@ def f():
df.eval('a = a + b', inplace=True)
result = old_a + df.b
assert_series_equal(result, df.a, check_names=False)
self.assertTrue(result.name is None)
assert result.name is None

f()

Expand Down Expand Up @@ -1435,43 +1435,43 @@ def test_simple_in_ops(self):
if self.parser != 'python':
res = pd.eval('1 in [1, 2]', engine=self.engine,
parser=self.parser)
self.assertTrue(res)
assert res

res = pd.eval('2 in (1, 2)', engine=self.engine,
parser=self.parser)
self.assertTrue(res)
assert res

res = pd.eval('3 in (1, 2)', engine=self.engine,
parser=self.parser)
assert not res

res = pd.eval('3 not in (1, 2)', engine=self.engine,
parser=self.parser)
self.assertTrue(res)
assert res

res = pd.eval('[3] not in (1, 2)', engine=self.engine,
parser=self.parser)
self.assertTrue(res)
assert res

res = pd.eval('[3] in ([3], 2)', engine=self.engine,
parser=self.parser)
self.assertTrue(res)
assert res

res = pd.eval('[[3]] in [[[3]], 2]', engine=self.engine,
parser=self.parser)
self.assertTrue(res)
assert res

res = pd.eval('(3,) in [(3,), 2]', engine=self.engine,
parser=self.parser)
self.assertTrue(res)
assert res

res = pd.eval('(3,) not in [(3,), 2]', engine=self.engine,
parser=self.parser)
assert not res

res = pd.eval('[(3,)] in [[(3,)], 2]', engine=self.engine,
parser=self.parser)
self.assertTrue(res)
assert res
else:
with pytest.raises(NotImplementedError):
pd.eval('1 in [1, 2]', engine=self.engine, parser=self.parser)
Expand Down
16 changes: 8 additions & 8 deletions pandas/tests/dtypes/test_cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,27 +161,27 @@ class TestMaybe(tm.TestCase):
def test_maybe_convert_string_to_array(self):
result = maybe_convert_string_to_object('x')
tm.assert_numpy_array_equal(result, np.array(['x'], dtype=object))
self.assertTrue(result.dtype == object)
assert result.dtype == object

result = maybe_convert_string_to_object(1)
self.assertEqual(result, 1)

arr = np.array(['x', 'y'], dtype=str)
result = maybe_convert_string_to_object(arr)
tm.assert_numpy_array_equal(result, np.array(['x', 'y'], dtype=object))
self.assertTrue(result.dtype == object)
assert result.dtype == object

# unicode
arr = np.array(['x', 'y']).astype('U')
result = maybe_convert_string_to_object(arr)
tm.assert_numpy_array_equal(result, np.array(['x', 'y'], dtype=object))
self.assertTrue(result.dtype == object)
assert result.dtype == object

# object
arr = np.array(['x', 2], dtype=object)
result = maybe_convert_string_to_object(arr)
tm.assert_numpy_array_equal(result, np.array(['x', 2], dtype=object))
self.assertTrue(result.dtype == object)
assert result.dtype == object

def test_maybe_convert_scalar(self):

Expand Down Expand Up @@ -220,17 +220,17 @@ def test_maybe_convert_objects_copy(self):
values = np.array([1, 2])

out = maybe_convert_objects(values, copy=False)
self.assertTrue(values is out)
assert values is out

out = maybe_convert_objects(values, copy=True)
self.assertTrue(values is not out)
assert values is not out

values = np.array(['apply', 'banana'])
out = maybe_convert_objects(values, copy=False)
self.assertTrue(values is out)
assert values is out

out = maybe_convert_objects(values, copy=True)
self.assertTrue(values is not out)
assert values is not out


class TestCommonTypes(tm.TestCase):
Expand Down
Loading