Пример #1
0
def test_csv_formatter_format_header():
    """Tests CSVFormatter.format_header() method."""
    columns = ['t', 'x', 'y', 'z', 'V']
    formatter = CSVFormatter(columns=columns)
    assert formatter.format_header() == 't,x,y,z,V'
Пример #2
0
def test_csv_formatter_format():
    """Tests CSVFormatter.format() method."""
    columns = ['t', 'x', 'y', 'z', 'V']
    formatter = CSVFormatter(columns=columns)
    data = {'t': 1, 'y': 2, 'z': 3.0, 'x': -1, 'V': 'abc'}
    assert formatter.format(data) == '1,-1,2,3.0,abc'