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"}
def test_csv_filename(): connector = CsvConnector(CSV_FILENAME, delimiter=DELIMITER, quotechar=QUOTECHAR, mode=CsvModeEnum.FILENAME) obtained = connector.query(Query()) assert obtained == EXPECTED
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
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
def test_csv_string(): connector = CsvConnector(CSV_STRING, delimiter=DELIMITER, quotechar=QUOTECHAR, mode=CsvModeEnum.STRING) obtained = connector.query(Query()) assert obtained == EXPECTED