Skip to content

Commit

Permalink
pytests for magnitudeVisual, userDefinedStars
Browse files Browse the repository at this point in the history
  • Loading branch information
cyschneck committed Mar 8, 2024
1 parent 5fe2e93 commit d4a0a3f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ def test_finalPositionOfStars_isPrecessionIncludedInvalidTypes(invalid_input, er
with pytest.raises(ValueError, match=re.escape(f"[isPrecessionIncluded]: Must be a bool, current type = '{error_output}'")):
scsp.finalPositionOfStars(isPrecessionIncluded=invalid_input)

@pytest.mark.parametrize("invalid_input, error_output", invalid_non_num_options)
@pytest.mark.parametrize("invalid_input, error_output", invalid_non_list_options)
def test_finalPositionOfStars_userDefinedStarsInvalidTypes(invalid_input, error_output):
with pytest.raises(ValueError, match=re.escape(f"[userDefinedStars]: Must be a list, current type = '{error_output}'")):
scsp.finalPositionOfStars(userDefinedStars=invalid_input)

@pytest.mark.parametrize("invalid_input, error_output", invalid_non_num_options)
def test_finalPositionOfStars_userDefinedStarsInvalidStarTypes(invalid_input, error_output):
with pytest.raises(ValueError, match=re.escape(f"[userDefinedStars]: {error_output} is not a valid newStar object (see: star_chart_spherical_projection.newStar)")):
scsp.finalPositionOfStars(userDefinedStars=[invalid_input])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_plotStereographicProjection_figPlotColorInvalidTypes(invalid_input, err

@pytest.mark.parametrize("invalid_input, error_output", invalid_non_num_options)
def test_plotStereographicProjection_figsizeNInvalidTypes(invalid_input, error_output):
with pytest.raises(ValueError, match=re.escape(f"figsize_n]: Must be a int or float, current type = '{error_output}'")):
with pytest.raises(ValueError, match=re.escape(f"[figsize_n]: Must be a int or float, current type = '{error_output}'")):
scsp.plotStereographicProjection(northOrSouth="North", figsize_n=invalid_input)

@pytest.mark.parametrize("invalid_input, error_output", invalid_non_num_options)
Expand Down
19 changes: 19 additions & 0 deletions star_chart_spherical_projection/pytests/test_starClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,22 @@ def test_starClass_properMotionAnglevsRA():
properMotionAngle=12.3,
properMotionSpeedDec=None,
properMotionSpeedRA=34.5)

def test_starClass_magnitudeVisualRequired():
with pytest.raises(ValueError, match=re.escape("[magnitudeVisual]: magnitudeVisual is required")):
scsp.newStar(starName="Testing Star",
ra="1.2.3",
dec=12.3,
magnitudeVisual=None,
properMotionSpeed=12.3,
properMotionAngle=32.1)

@pytest.mark.parametrize("invalid_input, error_output", invalid_non_num_options)
def test_starClass_magnitudeVisualRequired(invalid_input, error_output):
with pytest.raises(ValueError, match=re.escape(f"[magnitudeVisual]: Must be a int or float, current type = '{error_output}'")):
scsp.newStar(starName="Testing Star",
ra="1.2.3",
dec=12.3,
magnitudeVisual=invalid_input,
properMotionSpeed=12.3,
properMotionAngle=32.1)

0 comments on commit d4a0a3f

Please sign in to comment.