From 202c34f10b12a0c89f175c123c3b30d02e6d4821 Mon Sep 17 00:00:00 2001 From: Sandro Campos Date: Tue, 19 Nov 2024 16:58:58 -0500 Subject: [PATCH] Improve error message --- tests/lsdb/catalog/test_box_search.py | 4 +--- tests/lsdb/catalog/test_cone_search.py | 6 ++---- tests/lsdb/catalog/test_polygon_search.py | 6 ++---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/tests/lsdb/catalog/test_box_search.py b/tests/lsdb/catalog/test_box_search.py index f97dc11c..fe2d5abb 100644 --- a/tests/lsdb/catalog/test_box_search.py +++ b/tests/lsdb/catalog/test_box_search.py @@ -1,5 +1,3 @@ -import re - import numpy as np import pytest from hats.pixel_math.validators import ValidatorsErrors @@ -88,7 +86,7 @@ def test_box_search_coarse_versus_fine(small_sky_order1_catalog): def test_box_search_invalid_args(small_sky_order1_catalog): # Some declination values are out of the [-90,90] bounds - with pytest.raises(ValueError, match=re.escape(ValidatorsErrors.INVALID_DEC)): + with pytest.raises(ValueError, match=ValidatorsErrors.INVALID_DEC): small_sky_order1_catalog.box_search(ra=(0, 30), dec=(-100, -70)) # Declination values should be in ascending order with pytest.raises(ValueError, match=ValidatorsErrors.INVALID_RADEC_RANGE): diff --git a/tests/lsdb/catalog/test_cone_search.py b/tests/lsdb/catalog/test_cone_search.py index 20cddabb..2be0e6ee 100644 --- a/tests/lsdb/catalog/test_cone_search.py +++ b/tests/lsdb/catalog/test_cone_search.py @@ -1,5 +1,3 @@ -import re - import nested_dask as nd import nested_pandas as npd import pandas as pd @@ -111,9 +109,9 @@ def test_cone_search_coarse_versus_fine(small_sky_order1_catalog): def test_invalid_dec_and_negative_radius(small_sky_order1_catalog): - with pytest.raises(ValueError, match=re.escape(ValidatorsErrors.INVALID_DEC)): + with pytest.raises(ValueError, match=ValidatorsErrors.INVALID_DEC): small_sky_order1_catalog.cone_search(0, -100.3, 1.2) - with pytest.raises(ValueError, match=re.escape(ValidatorsErrors.INVALID_DEC)): + with pytest.raises(ValueError, match=ValidatorsErrors.INVALID_DEC): small_sky_order1_catalog.cone_search(0, 100.4, 1.3) with pytest.raises(ValueError, match=ValidatorsErrors.INVALID_RADIUS): small_sky_order1_catalog.cone_search(0, 0, -1.5) diff --git a/tests/lsdb/catalog/test_polygon_search.py b/tests/lsdb/catalog/test_polygon_search.py index ad9fc004..fd3f7e65 100644 --- a/tests/lsdb/catalog/test_polygon_search.py +++ b/tests/lsdb/catalog/test_polygon_search.py @@ -1,5 +1,3 @@ -import re - import nested_dask as nd import nested_pandas as npd import numpy as np @@ -75,8 +73,8 @@ def test_polygon_search_coarse_versus_fine(small_sky_order1_catalog): def test_polygon_search_invalid_dec(small_sky_order1_catalog): - # Some declination values are out of the [-90,90] bounds - with pytest.raises(ValueError, match=re.escape(ValidatorsErrors.INVALID_DEC)): + # Some declination values are out of the [-90,90[ bounds + with pytest.raises(ValueError, match=ValidatorsErrors.INVALID_DEC): vertices = [(-20, 100), (-20, -1), (20, -1), (20, 100)] small_sky_order1_catalog.polygon_search(vertices)