hjwp / pytest-icdiff

better error messages for assert equals in pytest
The Unlicense
312 stars 18 forks source link

[Feature request] Move preview to first actual difference #18

Closed m-aciek closed 3 years ago

m-aciek commented 4 years ago

Now we can get:

E       AssertionError: assert equals failed
E         {                                {                               
E           'landing_page': {                'landing_page': {             
E             'hgw': {                         'hgw': {                    
E               'left_section': {                'left_section': {         
E                 'texts': {                       'texts': {              
E                   'action_button': 'Sta            'action_button': 'Sta 
E         rt',                             rt',                            ...
E         
E         ...Full output truncated (469 lines hidden), use '-vv' to show

It would be cool to be able to see actual difference in dicts in a preview. Output could be scrolled to first difference, e.g.:

E       AssertionError: assert equals failed
E         …                               …                               
E           'in_the_wild': {                'in_the_wild': {             
E             'sth': {                         'sth': {                    
E               'some_section': {                'some_section': {         
E                 'fooos': {                       'fooos': {              
E                   'difference': 'foo',            
E                                                    'difference': 'bar',                         …
E         
E         ...Full output truncated (469 lines hidden), use '-vv' to show
hjwp commented 4 years ago

Good idea!

I think if you pass context=True to the icdiff make_table() call it might do what you want. Fancy trying it and submitting a PR? There's some lovely Internet Points (TM) in it for you!!

m-aciek commented 4 years ago

:) I will try to find time in a near future.