Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(85628)

Unified Diff: Lib/test/test_buffer.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_bisect.py ('k') | Lib/test/test_builtin.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_buffer.py Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/test_buffer.py Fri Feb 07 23:40:05 2014 +0200
@@ -1328,7 +1328,7 @@
# memoryview: reconstruct strides
ex = ndarray(items, shape=shape, format=fmt)
nd = ndarray(ex, getbuf=PyBUF_CONTIG_RO|PyBUF_FORMAT)
- self.assertTrue(nd.strides == ())
+ self.assertEqual(nd.strides, ())
mv = nd.memoryview_from_buffer()
self.verify(mv, obj=None,
itemsize=itemsize, fmt=fmt, readonly=1,
@@ -1556,13 +1556,13 @@
nd = ndarray(items, shape=[5], format=fmt)
for i, v in enumerate(nd):
self.assertEqual(v, items[i])
- self.assertTrue(v in nd)
+ self.assertIn(v, nd)
if is_memoryview_format(fmt):
mv = memoryview(nd)
for i, v in enumerate(mv):
self.assertEqual(v, items[i])
- self.assertTrue(v in mv)
+ self.assertIn(v, mv)
def test_ndarray_slice_invalid(self):
items = [1,2,3,4,5,6,7,8]
@@ -2500,8 +2500,8 @@
mv_err = e.__class__
if struct_err or mv_err:
- self.assertIsNot(struct_err, None)
- self.assertIsNot(mv_err, None)
+ self.assertIsNotNone(struct_err)
+ self.assertIsNotNone(mv_err)
else:
self.assertEqual(m[1], nd[1])
@@ -4256,7 +4256,7 @@
y = ndarray(x, getbuf=PyBUF_FULL_RO)
z = ndarray(y, getbuf=PyBUF_FULL_RO)
m = memoryview(z)
- self.assertIs(y.obj, None)
+ self.assertIsNone(y.obj)
self.assertIs(m.obj, z)
self.verify(m, obj=z,
itemsize=1, fmt=fmt, readonly=1,
@@ -4270,7 +4270,7 @@
m = memoryview(z)
# Clearly setting view.obj==NULL is inferior, since it
# messes up the redirection chain:
- self.assertIs(y.obj, None)
+ self.assertIsNone(y.obj)
self.assertIs(z.obj, y)
self.assertIs(m.obj, y)
self.verify(m, obj=y,
« no previous file with comments | « Lib/test/test_bisect.py ('k') | Lib/test/test_builtin.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+