Show More
@@ -1088,6 +1088,13 b' def test_dict_assignment():' | |||
|
1088 | 1088 | nt.assert_equal(d, c.value) |
|
1089 | 1089 | nt.assert_true(c.value is d) |
|
1090 | 1090 | |
|
1091 | def test_dict_default_value(): | |
|
1092 | """Check that the `{}` default value of the Dict traitlet constructor is | |
|
1093 | actually copied.""" | |
|
1094 | ||
|
1095 | d1, d2 = Dict(), Dict() | |
|
1096 | nt.assert_false(d1.get_default_value() is d2.get_default_value()) | |
|
1097 | ||
|
1091 | 1098 | class TestLink(TestCase): |
|
1092 | 1099 | def test_connect_same(self): |
|
1093 | 1100 | """Verify two traitlets of the same type can be linked together using link.""" |
@@ -1635,14 +1635,14 b' class Tuple(Container):' | |||
|
1635 | 1635 | class Dict(Instance): |
|
1636 | 1636 | """An instance of a Python dict.""" |
|
1637 | 1637 | |
|
1638 |
def __init__(self, default_value= |
|
|
1638 | def __init__(self, default_value={}, allow_none=True, **metadata): | |
|
1639 | 1639 | """Create a dict trait type from a dict. |
|
1640 | 1640 | |
|
1641 | 1641 | The default value is created by doing ``dict(default_value)``, |
|
1642 | 1642 | which creates a copy of the ``default_value``. |
|
1643 | 1643 | """ |
|
1644 | 1644 | if default_value is None: |
|
1645 |
args = |
|
|
1645 | args = None | |
|
1646 | 1646 | elif isinstance(default_value, dict): |
|
1647 | 1647 | args = (default_value,) |
|
1648 | 1648 | elif isinstance(default_value, SequenceTypes): |
@@ -1657,15 +1657,15 b' class Dict(Instance):' | |||
|
1657 | 1657 | class EventfulDict(Instance): |
|
1658 | 1658 | """An instance of an EventfulDict.""" |
|
1659 | 1659 | |
|
1660 |
def __init__(self, default_value= |
|
|
1660 | def __init__(self, default_value={}, allow_none=True, **metadata): | |
|
1661 | 1661 | """Create a EventfulDict trait type from a dict. |
|
1662 | 1662 | |
|
1663 |
The default value is created by doing |
|
|
1664 |
``eventful.EvenfulDict(default_value)``, which creates a copy of the |
|
|
1663 | The default value is created by doing | |
|
1664 | ``eventful.EvenfulDict(default_value)``, which creates a copy of the | |
|
1665 | 1665 | ``default_value``. |
|
1666 | 1666 | """ |
|
1667 | 1667 | if default_value is None: |
|
1668 |
args = |
|
|
1668 | args = None | |
|
1669 | 1669 | elif isinstance(default_value, dict): |
|
1670 | 1670 | args = (default_value,) |
|
1671 | 1671 | elif isinstance(default_value, SequenceTypes): |
General Comments 0
You need to be logged in to leave comments.
Login now