def test_open(csv_mock):
    reader = CSVInputReader()
    csv_mock.reader.return_value = iter([[" From ", " To", " Amount"], ["2", "3", "5"]])
    assert reader._CSVInputReader__data == None
    reader.open(123)
    csv_mock.reader.assert_called_with(123)
    assert next(reader._CSVInputReader__data) == ["2", "3", "5"]
def test_iter(test_iter_args):
    reader = CSVInputReader()
    reader._CSVInputReader__head = ["from", "to", "amount"]
    reader._CSVInputReader__data = iter([test_iter_args[0]])
    iterator = iter(reader)
    n = iterator.next()
    assert type(n) == type(test_iter_args[1])
    assert vars(n) == vars(test_iter_args[1])
Example #3
0
def test_open(csv_mock):
    reader = CSVInputReader()
    csv_mock.reader.return_value = iter([[' From ', ' To', ' Amount'],
                                         ['2', '3', '5']])
    assert reader._CSVInputReader__data == None
    reader.open(123)
    csv_mock.reader.assert_called_with(123)
    assert next(reader._CSVInputReader__data) == ['2', '3', '5']
Example #4
0
def test_iter(test_iter_args):
    reader = CSVInputReader()
    reader._CSVInputReader__head = ['from', 'to', 'amount']
    reader._CSVInputReader__data = iter([test_iter_args[0]])
    iterator = iter(reader)
    n = iterator.next()
    assert type(n) == type(test_iter_args[1])
    assert vars(n) == vars(test_iter_args[1])