it was failing because when the test case reaches the failing line, there are two keys in the result, so an itervalues().next() may or may not get the correct value that has the 'file' key. In other words, it was an error in the test case.