Improve the "not in" assertion output
This cleans up the generic diff and tailors the output more to this specific assertion (based on feedback from hpk).
This commit is contained in:
		
							parent
							
								
									d8d88ede65
								
							
						
					
					
						commit
						709d5e3f2c
					
				|  | @ -165,4 +165,15 @@ def _notin_text(term, text): | ||||||
|     head = text[:index] |     head = text[:index] | ||||||
|     tail = text[index+len(term):] |     tail = text[index+len(term):] | ||||||
|     correct_text = head + tail |     correct_text = head + tail | ||||||
|     return _diff_text(correct_text, text) |     diff = _diff_text(correct_text, text) | ||||||
|  |     newdiff = ['%s is contained here:' % py.io.saferepr(term, maxsize=42)] | ||||||
|  |     for line in diff: | ||||||
|  |         if line.startswith('Skipping'): | ||||||
|  |             continue | ||||||
|  |         if line.startswith('- '): | ||||||
|  |             continue | ||||||
|  |         if line.startswith('+ '): | ||||||
|  |             newdiff.append('  ' + line[2:]) | ||||||
|  |         else: | ||||||
|  |             newdiff.append(line) | ||||||
|  |     return newdiff | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue