def test_tsv_pandas(self): with open(os.path.join(BASE, 'files', 'test.tsv')) as fp: sheets = panda_tools.csv_pandas(fp) sheet = sheets.popitem()[1] assert sheet[0][0] == {'field': 'one\ttwo\tthree', 'id': 'one\ttwo\tthree', 'name': 'one\ttwo\tthree', 'sortable': True} assert sheet[1][0] == {'one\ttwo\tthree': 'a\tb\tc'}
def test_data_from_dateframe(self): with open(os.path.join(BASE, 'files', 'test.csv')) as fp: sheets = panda_tools.csv_pandas(fp) sheet = sheets.popitem()[1] assert type(sheet[0]) == list assert type(sheet[0][1]) == dict
def test_tsv_pandas(self): with open(os.path.join(BASE, 'files', 'test.tsv')) as fp: headers, data = panda_tools.csv_pandas(fp) assert headers[0] == { 'field': 'one\ttwo\tthree', 'id': 'one\ttwo\tthree', 'name': 'one\ttwo\tthree', 'sortable': True } assert data[0] == {'one\ttwo\tthree': 'a\tb\tc'}
def test_data_from_dateframe(self): with open(os.path.join(BASE, 'files', 'test.csv')) as fp: headers, data = panda_tools.csv_pandas(fp) assert type(data) == list assert type(data[0]) == dict
def test_tsv_pandas(self): with open(os.path.join(BASE, 'files', 'test.tsv')) as fp: headers, data = panda_tools.csv_pandas(fp) assert headers[0] == {'field': 'one\ttwo\tthree', 'id': 'one\ttwo\tthree', 'name': 'one\ttwo\tthree', 'sortable': True} assert data[0] == {'one\ttwo\tthree': 'a\tb\tc'}