- ``pyramid.testing.DummyResource`` didn't define ``__bool__``, so code under
Python 3 would use ``__len__`` to find truthiness; this usually caused an
instance of DummyResource to be "falsy" instead of "truthy". See
https://github.com/Pylons/pyramid/pull/1032
Closes #1032
| | |
| | | files have now been removed. See |
| | | https://github.com/Pylons/pyramid/issues/981 |
| | | |
| | | - ``pyramid.testing.DummyResource`` didn't define ``__bool__``, so code under |
| | | Python 3 would use ``__len__`` to find truthiness; this usually caused an |
| | | instance of DummyResource to be "falsy" instead of "truthy". See |
| | | https://github.com/Pylons/pyramid/pull/1032 |
| | | |
| | | 1.4 (2012-12-18) |
| | | ================ |
| | | |
| | |
| | | def __nonzero__(self): |
| | | return True |
| | | |
| | | __bool__ = __nonzero__ |
| | | |
| | | def __len__(self): |
| | | return len(self.subs) |
| | | |
| | |
| | | resource = self._makeOne() |
| | | self.assertEqual(resource.__nonzero__(), True) |
| | | |
| | | def test_bool(self): |
| | | resource = self._makeOne() |
| | | self.assertEqual(resource.__bool__(), True) |
| | | |
| | | def test_ctor_with__provides__(self): |
| | | resource = self._makeOne(__provides__=IDummy) |
| | | self.assertTrue(IDummy.providedBy(resource)) |