Skip to content

Commit

Permalink
Fix test for new implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
pp-mo committed Mar 13, 2018
1 parent 480f264 commit aee5926
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 9 additions & 2 deletions lib/iris/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,16 @@ def setUpClass(cls):
iris.site_configuration['cf_profile'] = None

def _assert_str_same(self, reference_str, test_str, reference_filename, type_comparison_name='Strings'):
def normlines(text):
text = [x + '\n'
for x in text.splitlines()
if x]
return text
reference_str = normlines(reference_str)
test_str = normlines(test_str)
if reference_str != test_str:
diff = ''.join(difflib.unified_diff(reference_str.splitlines(1), test_str.splitlines(1),
'Reference', 'Test result', '', '', 0))
diff = ''.join(difflib.unified_diff(reference_str, test_str,
'Reference', 'Test result', '', '', 0))
self.fail("%s do not match: %s\n%s" % (type_comparison_name, reference_filename, diff))

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2015, Met Office
# (C) British Crown Copyright 2014 - 2018, Met Office
#
# This file is part of Iris.
#
Expand Down Expand Up @@ -71,9 +71,7 @@ def _dummy_fields_iter(self, stashes=None, models=None, lbprocs=None):

def _group_result(self, fields):
# Run the testee, but returning just the groups (not FieldCollations).
with mock.patch('iris.fileformats.um._fast_load_structured_fields.'
'FieldCollation', new=lambda args: args):
result = list(group_structured_fields(fields))
result = list(group_structured_fields(fields, collation_class=tuple))
return result

def _test_fields(self, item):
Expand Down

0 comments on commit aee5926

Please sign in to comment.