@@ -459,6 +459,43 @@ def test_list_wrap_for_width_rewrap_same_length(self):
459
459
" ]" ,
460
460
]
461
461
462
+ def test_dict_wrap (self ):
463
+ d1 = {"common" : 1 , "env" : {"env1" : 1 }}
464
+ d2 = {"common" : 1 , "env" : {"env1" : 1 , "env2" : 2 }}
465
+
466
+ diff = callequal (d1 , d2 , verbose = True )
467
+ assert diff == [
468
+ "{'common': 1,...: {'env1': 1}} == {'common': 1,...1, 'env2': 2}}" ,
469
+ "Omitting 1 identical items, use -vv to show" ,
470
+ "Differing items:" ,
471
+ "{'env': {'env1': 1}} != {'env': {'env1': 1, 'env2': 2}}" ,
472
+ "Full diff:" ,
473
+ "- {'common': 1, 'env': {'env1': 1}}" ,
474
+ "+ {'common': 1, 'env': {'env1': 1, 'env2': 2}}" ,
475
+ "? +++++++++++" ,
476
+ ]
477
+
478
+ long_a = "a" * 80
479
+ sub = {"long_a" : long_a , "sub1" : {"long_a" : "substring that gets wrapped" }}
480
+ d1 = {"env" : {"sub" : sub }}
481
+ d2 = {"env" : {"sub" : sub }, "new" : 1 }
482
+ diff = callequal (d1 , d2 , verbose = True )
483
+ assert diff == [
484
+ "{'env': {'sub...s wrapped'}}}} == {'env': {'sub...}}}, 'new': 1}" ,
485
+ "Omitting 1 identical items, use -vv to show" ,
486
+ "Right contains 1 more item:" ,
487
+ "{'new': 1}" ,
488
+ "Full diff:" ,
489
+ " {" ,
490
+ " 'env': {'sub': {'long_a': '" + long_a + "'," ,
491
+ " 'sub1': {'long_a': 'substring '" ,
492
+ " 'that '" ,
493
+ " 'gets '" ,
494
+ " 'wrapped'}}}," ,
495
+ "+ 'new': 1," ,
496
+ " }" ,
497
+ ]
498
+
462
499
def test_dict (self ):
463
500
expl = callequal ({"a" : 0 }, {"a" : 1 })
464
501
assert len (expl ) > 1
0 commit comments