(self, a, b, c, res, expr="a[b:c]", meth="__getitem__")
| 111 | self.assertEqual(bm(b), res) |
| 112 | |
| 113 | def sliceop_test(self, a, b, c, res, expr="a[b:c]", meth="__getitem__"): |
| 114 | d = {'a': a, 'b': b, 'c': c} |
| 115 | self.assertEqual(eval(expr, d), res) |
| 116 | t = type(a) |
| 117 | m = getattr(t, meth) |
| 118 | while meth not in t.__dict__: |
| 119 | t = t.__bases__[0] |
| 120 | # in some implementations (e.g. PyPy), 'm' can be a regular unbound |
| 121 | # method object; the getattr() below obtains its underlying function. |
| 122 | self.assertEqual(getattr(m, 'im_func', m), t.__dict__[meth]) |
| 123 | self.assertEqual(m(a, slice(b, c)), res) |
| 124 | bm = getattr(a, meth) |
| 125 | self.assertEqual(bm(slice(b, c)), res) |
| 126 | |
| 127 | def setop_test(self, a, b, res, stmt="a+=b", meth="__iadd__"): |
| 128 | d = {'a': deepcopy(a), 'b': b} |
no test coverage detected