Show More
@@ -1,15 +1,7 b'' | |||
|
1 | 1 | """Test interact and interactive.""" |
|
2 | 2 | |
|
3 | #----------------------------------------------------------------------------- | |
|
4 | # Copyright (C) 2014 The IPython Development Team | |
|
5 | # | |
|
6 | # Distributed under the terms of the BSD License. The full license is in | |
|
7 | # the file COPYING, distributed as part of this software. | |
|
8 | #----------------------------------------------------------------------------- | |
|
9 | ||
|
10 | #----------------------------------------------------------------------------- | |
|
11 | # Imports | |
|
12 | #----------------------------------------------------------------------------- | |
|
3 | # Copyright (c) IPython Development Team. | |
|
4 | # Distributed under the terms of the Modified BSD License. | |
|
13 | 5 | |
|
14 | 6 | from __future__ import print_function |
|
15 | 7 | |
@@ -18,7 +10,7 b' from collections import OrderedDict' | |||
|
18 | 10 | import nose.tools as nt |
|
19 | 11 | import IPython.testing.tools as tt |
|
20 | 12 | |
|
21 | # from IPython.core.getipython import get_ipython | |
|
13 | from IPython.kernel.comm import Comm | |
|
22 | 14 | from IPython.html import widgets |
|
23 | 15 | from IPython.html.widgets import interact, interactive, Widget, interaction |
|
24 | 16 | from IPython.utils.py3compat import annotate |
@@ -27,8 +19,9 b' from IPython.utils.py3compat import annotate' | |||
|
27 | 19 | # Utility stuff |
|
28 | 20 | #----------------------------------------------------------------------------- |
|
29 | 21 | |
|
30 |
class DummyComm( |
|
|
22 | class DummyComm(Comm): | |
|
31 | 23 | comm_id = 'a-b-c-d' |
|
24 | ||
|
32 | 25 | def send(self, *args, **kwargs): |
|
33 | 26 | pass |
|
34 | 27 | |
@@ -37,10 +30,11 b' class DummyComm(object):' | |||
|
37 | 30 | |
|
38 | 31 | _widget_attrs = {} |
|
39 | 32 | displayed = [] |
|
33 | undefined = object() | |
|
40 | 34 | |
|
41 | 35 | def setup(): |
|
42 |
_widget_attrs['comm'] = Widget |
|
|
43 | Widget.comm = DummyComm() | |
|
36 | _widget_attrs['_comm_default'] = getattr(Widget, '_comm_default', undefined) | |
|
37 | Widget._comm_default = lambda self: DummyComm() | |
|
44 | 38 | _widget_attrs['_ipython_display_'] = Widget._ipython_display_ |
|
45 | 39 | def raise_not_implemented(*args, **kwargs): |
|
46 | 40 | raise NotImplementedError() |
@@ -48,6 +42,9 b' def setup():' | |||
|
48 | 42 | |
|
49 | 43 | def teardown(): |
|
50 | 44 | for attr, value in _widget_attrs.items(): |
|
45 | if value is undefined: | |
|
46 | delattr(Widget, attr) | |
|
47 | else: | |
|
51 | 48 | setattr(Widget, attr, value) |
|
52 | 49 | |
|
53 | 50 | def f(**kwargs): |
General Comments 0
You need to be logged in to leave comments.
Login now