File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,21 @@ def test_asdict_preserve_order(self, cls):
199199
200200 assert [a .name for a in fields (cls )] == list (dict_instance .keys ())
201201
202+ def test_retain_tuple_key (self ):
203+ """
204+ retain_collect_types also retains keys.
205+ """
206+
207+ @attr .s
208+ class A (object ):
209+ a = attr .ib ()
210+
211+ instance = A ({(1 ,): 1 })
212+
213+ assert {"a" : {(1 ,): 1 }} == attr .asdict (
214+ instance , retain_collection_types = True
215+ )
216+
202217 def test_tuple_keys (self ):
203218 """
204219 If a key is collection type, retain_collection_types is False,
@@ -212,7 +227,8 @@ class A(object):
212227 a = attr .ib ()
213228
214229 instance = A ({(1 ,): 1 })
215- attr .asdict (instance , tuple_keys = True )
230+
231+ assert {"a" : {(1 ,): 1 }} == attr .asdict (instance , tuple_keys = True )
216232
217233 def test_tuple_keys_retain_caught (self , C ):
218234 """
You can’t perform that action at this time.
0 commit comments