diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 896984d..c744d09 100644
|
a
|
b
|
class Select(Widget):
|
| 521 | 521 | # more than once. |
| 522 | 522 | self.choices = list(choices) |
| 523 | 523 | |
| | 524 | def __deepcopy__(self, memo): |
| | 525 | obj = copy.copy(self) |
| | 526 | obj.attrs = self.attrs.copy() |
| | 527 | obj.choices = copy.copy(self.choices) |
| | 528 | memo[id(self)] = obj |
| | 529 | return obj |
| | 530 | |
| 524 | 531 | def render(self, name, value, attrs=None, choices=()): |
| 525 | 532 | if value is None: |
| 526 | 533 | value = '' |
diff --git a/tests/forms_tests/tests/test_widgets.py b/tests/forms_tests/tests/test_widgets.py
index 40ff750..8b2d0c0 100644
|
a
|
b
|
class SelectDateWidgetTests(SimpleTestCase):
|
| 1997 | 1997 | # label tag is correctly associated with first rendered dropdown |
| 1998 | 1998 | a = GetDate({'mydate_month': '1', 'mydate_day': '1', 'mydate_year': '2010'}) |
| 1999 | 1999 | self.assertIn('<label for="id_mydate_day">', a.as_p()) |
| | 2000 | |
| | 2001 | |
| | 2002 | class SelectWidgetTests(SimpleTestCase): |
| | 2003 | |
| | 2004 | def test_deepcopy(self): |
| | 2005 | """ |
| | 2006 | Ensure that __deepcopy__ copies all fields properly. |
| | 2007 | Refs #25085 |
| | 2008 | """ |
| | 2009 | widget = Select() |
| | 2010 | obj = copy.deepcopy(widget) |
| | 2011 | self.assertTrue(widget is not obj) |
| | 2012 | self.assertTrue(widget.choices == obj.choices) |
| | 2013 | self.assertTrue(widget.choices is not obj.choices) |
| | 2014 | self.assertTrue(widget.attrs == obj.attrs) |
| | 2015 | self.assertTrue(widget.attrs is not obj.attrs) |