##// END OF EJS Templates
Restored major default completer functionality (cd, import, run)....
Restored major default completer functionality (cd, import, run). These completers had been put in quarantine, I've done a substantial amount of cleanup and restructuring of this code and put it in core.completerlib. There's still a lot to improve there (in particular adding unittests) but at least now it's much more readable and cleanly structured. This gives us back completion for cd, import and run that 0.10 had and which we had lost since the restructuring when the code was quarantined. Also removed the ipy_stock_completers file, the loading of these completers is now done in the init_completer method.

File last commit:

r2738:95a4f176
r2959:4a4ea220
Show More
test_plugin.py
46 lines | 1.3 KiB | text/x-python | PythonLexer
"""Tests for plugin.py"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from unittest import TestCase
from IPython.core.plugin import Plugin, PluginManager
#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
class FooPlugin(Plugin):
pass
class BarPlugin(Plugin):
pass
class BadPlugin(object):
pass
class PluginTest(TestCase):
def setUp(self):
self.manager = PluginManager()
def test_register_get(self):
self.assertEquals(None, self.manager.get_plugin('foo'))
foo = FooPlugin()
self.manager.register_plugin('foo', foo)
self.assertEquals(foo, self.manager.get_plugin('foo'))
bar = BarPlugin()
self.assertRaises(KeyError, self.manager.register_plugin, 'foo', bar)
bad = BadPlugin()
self.assertRaises(TypeError, self.manager.register_plugin, 'bad')
def test_unregister(self):
foo = FooPlugin()
self.manager.register_plugin('foo', foo)
self.manager.unregister_plugin('foo')
self.assertEquals(None, self.manager.get_plugin('foo'))