mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 21:51:57 +00:00
14 lines
452 B
Python
14 lines
452 B
Python
import difflib
|
|
|
|
class TSV:
|
|
"""Helper to get pretty diffs between expected and actual tab-separated value files"""
|
|
|
|
def __init__(self, contents):
|
|
self.lines = contents.readlines() if isinstance(contents, file) else contents.splitlines(True)
|
|
|
|
def __eq__(self, other):
|
|
return self.lines == other.lines
|
|
|
|
def diff(self, other):
|
|
return list(line.rstrip() for line in difflib.context_diff(self.lines, other.lines))[2:]
|