Esempio n. 1
0
def test_csv_attributes():
    stream = io.StringIO(CSV_STRING)
    connector = CsvConnector(stream, delimiter=DELIMITER, quotechar=QUOTECHAR, mode=CsvModeEnum.TEXTIO)
    assert connector.attributes("") == {"col1", "col2", "col3"}
Esempio n. 2
0
def test_csv_filename():
    connector = CsvConnector(CSV_FILENAME, delimiter=DELIMITER, quotechar=QUOTECHAR, mode=CsvModeEnum.FILENAME)
    obtained = connector.query(Query())
    assert obtained == EXPECTED
Esempio n. 3
0
def test_csv_stringio():
    stream = io.StringIO(CSV_STRING)
    connector = CsvConnector(stream, delimiter=DELIMITER, quotechar=QUOTECHAR, mode=CsvModeEnum.TEXTIO)
    obtained = connector.query(Query())
    assert obtained == EXPECTED
Esempio n. 4
0
def test_csv_textiowrapper():
    with open(CSV_FILENAME) as stream:
        connector = CsvConnector(stream, delimiter=DELIMITER, quotechar=QUOTECHAR, mode=CsvModeEnum.TEXTIO)
        obtained = connector.query(Query())
        assert obtained == EXPECTED
Esempio n. 5
0
def test_csv_string():
    connector = CsvConnector(CSV_STRING, delimiter=DELIMITER, quotechar=QUOTECHAR, mode=CsvModeEnum.STRING)
    obtained = connector.query(Query())
    assert obtained == EXPECTED