From b26aafe27c458e429814d006fc7fe9a7c497715f 2013-08-01 18:29:18 From: Jonathan Frederic Date: 2013-08-01 18:29:18 Subject: [PATCH] Add leave_padding option to fuzzy compare --- diff --git a/IPython/nbconvert/tests/base.py b/IPython/nbconvert/tests/base.py index c3d58e8..021b784 100644 --- a/IPython/nbconvert/tests/base.py +++ b/IPython/nbconvert/tests/base.py @@ -37,7 +37,7 @@ class TestsBase(object): def fuzzy_compare(self, a, b, newlines_are_spaces=True, tabs_are_spaces=True, fuzzy_spacing=True, ignore_spaces=False, - ignore_newlines=False, case_sensitive=False): + ignore_newlines=False, case_sensitive=False, leave_padding=False): """ Performs a fuzzy comparison of two strings. A fuzzy comparison is a comparison that ignores insignificant differences in the two comparands. @@ -45,6 +45,10 @@ class TestsBase(object): parameters of this method. """ + if not leave_padding: + a = a.strip() + b = b.strip() + if ignore_newlines: a = a.replace('\n', '') b = b.replace('\n', '')