fix a bug

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-04-14 17:25:59 +02:00
parent de4c2dc98d
commit f0a277008a
2 changed files with 7 additions and 3 deletions

View File

@ -90,9 +90,7 @@ class Registry:
l = [] l = []
if plugins is None: if plugins is None:
plugins = self._plugins plugins = self._plugins
if extra: for plugin in list(plugins) + list(extra):
plugins += list(extra)
for plugin in plugins:
try: try:
l.append(getattr(plugin, attrname)) l.append(getattr(plugin, attrname))
except AttributeError: except AttributeError:

View File

@ -135,6 +135,12 @@ class TestRegistry:
l = list(plugins.listattr('x', reverse=True)) l = list(plugins.listattr('x', reverse=True))
assert l == [43, 42, 41] assert l == [43, 42, 41]
class api4:
x = 44
l = list(plugins.listattr('x', extra=(api4,)))
assert l == range(41, 45)
assert len(list(plugins)) == 3 # otherwise extra added
def test_api_and_defaults(): def test_api_and_defaults():
assert isinstance(py._com.comregistry, Registry) assert isinstance(py._com.comregistry, Registry)