with catch_warning() as w:
self.assertWarning(cell0 < cell1, w, expected)
- def test_filter(self):
- from itertools import ifilter
- from future_builtins import filter
- expected = 'ifilter with None as a first argument is not supported '\
- 'in 3.x. Use a list comprehension instead.'
-
- with catch_warning() as w:
- self.assertWarning(ifilter(None, []), w, expected)
- with catch_warning() as w:
- self.assertWarning(filter(None, []), w, expected)
-
def test_code_inequality_comparisons(self):
expected = 'code inequality comparisons not supported in 3.x.'
def f(x):
if (!PyArg_UnpackTuple(args, "ifilter", 2, 2, &func, &seq))
return NULL;
- if (func == Py_None) {
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "ifilter with None as a first argument "
- "is not supported in 3.x. Use a list "
- "comprehension instead.") < 0)
- return NULL;
- }
-
/* Get iterator. */
it = PyObject_GetIter(seq);
if (it == NULL)
}
if (func == (PyObject *)&PyBool_Type || func == Py_None) {
- if (Py_Py3kWarningFlag &&
- PyErr_Warn(PyExc_DeprecationWarning,
- "filter with None as a first argument "
- "is not supported in 3.x. Use a list "
- "comprehension instead.") < 0)
- return NULL;
-
ok = PyObject_IsTrue(item);
}
else {