From bfd93bd55b2e57ca21f9ec63cf1e88ebdc7235b1 Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Fri, 10 Feb 2023 16:35:01 -0500 Subject: [PATCH] Use simpler form for doctests --- read_in.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/read_in.py b/read_in.py index 309577a..f019400 100644 --- a/read_in.py +++ b/read_in.py @@ -24,13 +24,13 @@ def read_single_elevation(dat: str) -> Result[int, str]: string. Otherwise, returns the elevation in millimeters. >>> read_single_elevation("1.9333473e+02") - Ok(val=193334) + Ok(193334) >>> read_single_elevation("1.0") - Ok(val=1000) + Ok(1000) >>> read_single_elevation("10.0m") - Err(err='10.0m') + Err('10.0m') """ return map_res( meters_to_millimeters, # fuck floating points @@ -55,10 +55,10 @@ def read_elevation_line(line: str) -> Result[Iterator[int], Tuple[int, str]]: in these columns will not be returned. >>> map_res(list, read_elevation_line("1.9e2 18e1 181 179.1 ignored 170.1 1.8e2 18i+2 20e1")) - Ok(val=[190000, 180000, 181000, 179100]) + Ok([190000, 180000, 181000, 179100]) >>> map_res(list, read_elevation_line("1.9e2 18e 181 179.1 ignored 170.1 1.8e2 18i+2 20e1")) - Err(err=(2, '18e')) + Err((2, '18e')) """ return sequence([ map_err( @@ -99,14 +99,14 @@ def read_elevations(lines: str) -> Result[Iterator[int], ErrorLocation]: ... 11 2.0 3e1 4 5 6 7 bwa 9 10 ... 11 2.0 3e0 4 5 ign err 8 9 10 ... ''')) - Ok(val=[1000, 2000, 3000, 4000, 5000, 11000, 2000, 30000, 4000, 5000, 11000, 2000, 3000, 4000, 5000]) + Ok([1000, 2000, 3000, 4000, 5000, 11000, 2000, 30000, 4000, 5000, 11000, 2000, 3000, 4000, 5000]) >>> map_res(list, read_elevations(''' ... 1 2 3 4 5 6 7 8 9e 10 ... 11 ERR 3e1 4 5 6 7 bwa 9 10 ... 11 2.0 3e0 4 5 ign err 8 9 10 ... ''')) - Err(err=ErrorLocation(line_no=2, col_no=2, invalid_entry='ERR')) + Err(ErrorLocation(line_no=2, col_no=2, invalid_entry='ERR')) """ return map_res( chain.from_iterable,