File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,17 @@ def has_key(self, key):
58
58
"""Compatibility with python-ldap 2.x"""
59
59
return key in self
60
60
61
+ @property
62
+ def data (self ):
63
+ """Compatibility with older IterableUserDict-based implementation"""
64
+ warnings .warn (
65
+ 'ldap.cidict.cidict.data is an internal attribute; it may be ' +
66
+ 'removed at any time' ,
67
+ category = DeprecationWarning ,
68
+ stacklevel = 2 ,
69
+ )
70
+ return self ._data
71
+
61
72
62
73
def strlist_minus (a ,b ):
63
74
"""
Original file line number Diff line number Diff line change @@ -62,6 +62,16 @@ def test_strlist_deprecated(self):
62
62
strlist_func (["a" ], ["b" ])
63
63
self .assertEqual (len (w ), 1 )
64
64
65
+ def test_cidict_data (self ):
66
+ """test the deprecated data atrtribute"""
67
+ d = ldap .cidict .cidict ({'A' : 1 , 'B' : 2 })
68
+ with warnings .catch_warnings (record = True ) as w :
69
+ warnings .resetwarnings ()
70
+ warnings .simplefilter ('always' , DeprecationWarning )
71
+ data = d .data
72
+ assert data == {'a' : 1 , 'b' : 2 }
73
+ self .assertEqual (len (w ), 1 )
74
+
65
75
66
76
if __name__ == '__main__' :
67
77
unittest .main ()
You can’t perform that action at this time.
0 commit comments