Skip to content

CLN: More work on converting assert_'s to specialized forms #6261

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
Feb 5, 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
4 changes: 2 additions & 2 deletions pandas/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ def test_1d_bool(self):
self.assert_(np.array_equal(result, expected))

result = com.take_1d(arr, [0, 2, -1])
self.assert_(result.dtype == np.object_)
self.assertEqual(result.dtype, np.object_)

def test_2d_bool(self):
arr = np.array([[0, 1, 0],
Expand All @@ -819,7 +819,7 @@ def test_2d_bool(self):
self.assert_(np.array_equal(result, expected))

result = com.take_nd(arr, [0, 2, -1])
self.assert_(result.dtype == np.object_)
self.assertEqual(result.dtype, np.object_)

def test_2d_float32(self):
arr = np.random.randn(4, 3).astype(np.float32)
Expand Down
16 changes: 8 additions & 8 deletions pandas/tests/test_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,19 @@ def test_invalid(self):

# no op
result = expr._can_use_numexpr(operator.add, None, self.frame, self.frame, 'evaluate')
self.assert_(result == False)
self.assertFalse(result)

# mixed
result = expr._can_use_numexpr(operator.add, '+', self.mixed, self.frame, 'evaluate')
self.assert_(result == False)
self.assertFalse(result)

# min elements
result = expr._can_use_numexpr(operator.add, '+', self.frame2, self.frame2, 'evaluate')
self.assert_(result == False)
self.assertFalse(result)

# ok, we only check on first part of expression
result = expr._can_use_numexpr(operator.add, '+', self.frame, self.frame2, 'evaluate')
self.assert_(result == True)
self.assertTrue(result)

def test_binary_ops(self):

Expand All @@ -265,14 +265,14 @@ def testit():
op = getattr(operator, op, None)
if op is not None:
result = expr._can_use_numexpr(op, op_str, f, f, 'evaluate')
self.assert_(result == (not f._is_mixed_type))
self.assertNotEqual(result, f._is_mixed_type)

result = expr.evaluate(op, op_str, f, f, use_numexpr=True)
expected = expr.evaluate(op, op_str, f, f, use_numexpr=False)
assert_array_equal(result,expected.values)

result = expr._can_use_numexpr(op, op_str, f2, f2, 'evaluate')
self.assert_(result == False)
self.assertFalse(result)


expr.set_use_numexpr(False)
Expand Down Expand Up @@ -300,14 +300,14 @@ def testit():
op = getattr(operator,op)

result = expr._can_use_numexpr(op, op_str, f11, f12, 'evaluate')
self.assert_(result == (not f11._is_mixed_type))
self.assertNotEqual(result, f11._is_mixed_type)

result = expr.evaluate(op, op_str, f11, f12, use_numexpr=True)
expected = expr.evaluate(op, op_str, f11, f12, use_numexpr=False)
assert_array_equal(result,expected.values)

result = expr._can_use_numexpr(op, op_str, f21, f22, 'evaluate')
self.assert_(result == False)
self.assertFalse(result)

expr.set_use_numexpr(False)
testit()
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def test_to_string_repr_unicode(self):
except:
pass
if not line.startswith('dtype:'):
self.assert_(len(line) == line_len)
self.assertEqual(len(line), line_len)

# it works even if sys.stdin in None
_stdin= sys.stdin
Expand Down Expand Up @@ -731,7 +731,7 @@ def test_nonunicode_nonascii_alignment(self):
df = DataFrame([["aa\xc3\xa4\xc3\xa4", 1], ["bbbb", 2]])
rep_str = df.to_string()
lines = rep_str.split('\n')
self.assert_(len(lines[1]) == len(lines[2]))
self.assertEqual(len(lines[1]), len(lines[2]))

def test_unicode_problem_decoding_as_ascii(self):
dm = DataFrame({u('c/\u03c3'): Series({'test': np.NaN})})
Expand Down Expand Up @@ -915,7 +915,7 @@ def test_long_series(self):
import re
str_rep = str(s)
nmatches = len(re.findall('dtype',str_rep))
self.assert_(nmatches == 1)
self.assertEqual(nmatches, 1)

def test_index_with_nan(self):
# GH 2850
Expand Down
Loading