File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
python/ipywidgets/ipywidgets/widgets Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 13
13
from .. import widget
14
14
from ..widget import Widget
15
15
from ..widget_button import Button
16
+ import copy
16
17
17
18
18
19
def test_no_widget_view ():
@@ -80,3 +81,11 @@ def test_compatibility():
80
81
caller_path = inspect .stack (context = 0 )[1 ].filename
81
82
assert all (x .filename == caller_path for x in record )
82
83
assert len (record ) == 6
84
+
85
+
86
+ def test_widget_copy ():
87
+ button = Button ()
88
+ with pytest .raises (NotImplementedError ):
89
+ copy .copy (button )
90
+ with pytest .raises (NotImplementedError ):
91
+ copy .deepcopy (button )
Original file line number Diff line number Diff line change @@ -504,6 +504,12 @@ def __init__(self, **kwargs):
504
504
505
505
Widget ._call_widget_constructed (self )
506
506
self .open ()
507
+
508
+ def __copy__ (self ):
509
+ raise NotImplementedError ("Widgets cannot be copied; custom implementation required" )
510
+
511
+ def __deepcopy__ (self , memo ):
512
+ raise NotImplementedError ("Widgets cannot be copied; custom implementation required" )
507
513
508
514
def __del__ (self ):
509
515
"""Object disposal"""
You can’t perform that action at this time.
0 commit comments