11from click .testing import CliRunner
22
33from mapbox_tilesets .scripts .cli import estimate_area
4+ from utils import clean_runner_output
45
56
67# rainy day scenarios
@@ -11,7 +12,7 @@ def test_cli_estimate_area_features_from_invalid_stdin_geojson():
1112 estimate_area , ["--precision" , "10m" ], input = "invalidGeoJson input"
1213 )
1314 assert invalidated_result .exit_code == 1
14- assert str (invalidated_result .exception ) == message
15+ assert clean_runner_output (invalidated_result .output ) == message
1516
1617
1718def test_cli_estimate_area_features_from_invalid_geojson_content ():
@@ -21,7 +22,7 @@ def test_cli_estimate_area_features_from_invalid_geojson_content():
2122 estimate_area ,
2223 ["tests/fixtures/invalid-geojson.ldgeojson" , "--precision" , "1m" ],
2324 )
24- assert message in str (invalidated_result .exception )
25+ assert message in str (invalidated_result .output )
2526 assert invalidated_result .exit_code == 1
2627
2728
@@ -32,7 +33,7 @@ def test_cli_estimate_area_features_from_nonexistent_geojson_file():
3233 estimate_area ,
3334 ["tests/fixtures/nonexistent-geojson.ldgeojson" , "--precision" , "1m" ],
3435 )
35- assert str (invalidated_result .exception ) == message
36+ assert clean_runner_output (invalidated_result .output ) == message
3637 assert invalidated_result .exit_code == 1
3738
3839
@@ -64,7 +65,7 @@ def test_cli_estimate_area_1cm_precision_without_flag():
6465 ["tests/fixtures/valid.ldgeojson" , "-p" , "1cm" ],
6566 )
6667 assert invalidated_result .exit_code == 1
67- assert str (invalidated_result .exception ) == message
68+ assert clean_runner_output (invalidated_result .output ) == message
6869
6970
7071def test_cli_estimate_area_invalid_1cm_precision_flag ():
@@ -75,7 +76,7 @@ def test_cli_estimate_area_invalid_1cm_precision_flag():
7576 ["tests/fixtures/valid.ldgeojson" , "-p" , "1m" , "--force-1cm" ],
7677 )
7778 assert invalidated_result .exit_code == 1
78- assert str (invalidated_result .exception ) == message
79+ assert clean_runner_output (invalidated_result .output ) == message
7980
8081
8182# sunny day scenarios
0 commit comments