Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
camposandro committed Nov 19, 2024
1 parent bdeb8cd commit 202c34f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
4 changes: 1 addition & 3 deletions tests/lsdb/catalog/test_box_search.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import re

import numpy as np
import pytest
from hats.pixel_math.validators import ValidatorsErrors
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 2 additions & 4 deletions tests/lsdb/catalog/test_cone_search.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import re

import nested_dask as nd
import nested_pandas as npd
import pandas as pd
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions tests/lsdb/catalog/test_polygon_search.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import re

import nested_dask as nd
import nested_pandas as npd
import numpy as np
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 202c34f

Please sign in to comment.