From: Cyril Roelandt Date: Fri, 21 Aug 2015 09:56:42 +0000 (+0200) Subject: Python 3: do not do "assertFalse(filter(...))" X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=16142d8d372482182564a416aa66d10133571ff2;p=openstack-build%2Fneutron-build.git Python 3: do not do "assertFalse(filter(...))" This does not work in Python 3 since filter does not return a list. Fix this by replacing it with a list comprehension. Blueprint: neutron-python3 Change-Id: I59a63f7adedaf2217aa8fc9aae63045b4e620361 --- diff --git a/neutron/tests/unit/objects/test_base.py b/neutron/tests/unit/objects/test_base.py index 381ff8b29..71a0dd2e6 100644 --- a/neutron/tests/unit/objects/test_base.py +++ b/neutron/tests/unit/objects/test_base.py @@ -182,8 +182,7 @@ class BaseObjectIfaceTestCase(_BaseObjectTestCase, test_base.BaseTestCase): fake_field='xxx') def _validate_objects(self, expected, observed): - self.assertFalse( - filter(lambda obj: not self._is_test_class(obj), observed)) + self.assertTrue(all(self._is_test_class(obj) for obj in observed)) self.assertEqual( sorted(expected), sorted(get_obj_db_fields(obj) for obj in observed))