##// END OF EJS Templates
Quick fix for #1688, traceback-unicode issue...
Quick fix for #1688, traceback-unicode issue By importing unicode_literals from __future__ and casting to unicode at two locations a simple case now works. However I have not audited the code to find other locations where casts may be necessary. No new failures were noted when running the testsuite.

File last commit:

r7874:4a6836ce
r8299:660787db
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.assertEqual(None, self.manager.get_plugin('foo'))
foo = FooPlugin()
self.manager.register_plugin('foo', foo)
self.assertEqual(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.assertEqual(None, self.manager.get_plugin('foo'))