예제 #1
0
def test_read_single(tmp_path):
    file = tmp_path / "in"
    file.write_text('12345\n')

    result = reader.read_single(file)

    assert_that(result).is_equal_to('12345')
예제 #2
0
def test_read_single_with_mapper(tmp_path):
    file = tmp_path / "in"
    file.write_text('12345\n')

    result = reader.read_single(file, mapper=int)

    assert_that(result).is_equal_to(12345)
예제 #3
0
def test_read_single_with_splitter_and_mapper(tmp_path):
    file = tmp_path / "in"
    file.write_text('12345 67890\n')

    result = reader.read_single(file, splitter=' ', mapper=int)

    assert_that(result).is_equal_to([12345, 67890])
예제 #4
0
def test_read_single_with_splitter(tmp_path):
    file = tmp_path / "in"
    file.write_text('12345 67890\n')

    result = reader.read_single(file, splitter=' ')

    assert_that(result).is_equal_to(['12345', '67890'])
예제 #5
0
def read(filename='in'):
    return read_single(__file__, filename, mapper=map_to_int_list)
예제 #6
0
def read(filename='in'):
    return read_single(__file__, mapper=list)
예제 #7
0
def read(filename='in'):
    return read_single(__file__, filename, mapper=int)
예제 #8
0
def read(filename='in'):
    return read_single(__file__, filename)
예제 #9
0
def read(filename='in'):
    return read_single(__file__, filename, splitter=',')
예제 #10
0
def read(filename='in'):
    return read_single(__file__, filename, splitter='\t', mapper=int)