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')
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)
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])
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'])
def read(filename='in'): return read_single(__file__, filename, mapper=map_to_int_list)
def read(filename='in'): return read_single(__file__, mapper=list)
def read(filename='in'): return read_single(__file__, filename, mapper=int)
def read(filename='in'): return read_single(__file__, filename)
def read(filename='in'): return read_single(__file__, filename, splitter=',')
def read(filename='in'): return read_single(__file__, filename, splitter='\t', mapper=int)