Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
24 lines (17 loc) · 641 Bytes

File metadata and controls

24 lines (17 loc) · 641 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import csv
import io
from hamcrest.core.base_matcher import BaseMatcher
class CsvEquivalent(BaseMatcher):
def __init__(self, rows, **csv_kwargs):
self.__rows = rows
self.__csv_kwargs = csv_kwargs
def _matches(self, item):
with io.StringIO(item, newline="") as stream:
reader = csv.reader(stream, **self.__csv_kwargs)
return list(reader) == self.__rows
def describe_to(self, description):
description.append_text(
f"csv document equivalent to {self.__rows!r}"
)
def csv_equivalent(rows, **csv_kwargs):
return CsvEquivalent(rows, **csv_kwargs)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.