Skip to content

Commit

Permalink
csv extension pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
cyschneck committed Mar 8, 2024
1 parent c4e32b7 commit 5fe2e93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion star_chart_spherical_projection/error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def errorHandling(isPlotFunction=None,
if type(save_to_csv) != str:
raise ValueError(f"[save_to_csv]: Must be a str, current type = '{type(save_to_csv)}'")
if not save_to_csv.lower().endswith(".csv"):
raise ValueError(f"[save_to_csv]: Extension must be a .csv file, current extension = '{save_to_csv.split(".")[1]}'")
raise ValueError(f"[save_to_csv]: Extension must be a .csv file, current extension = '{save_to_csv.split('.')[1]}'")

# Error Handling for plotStereographicProjection() function
if isPlotFunction:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,7 @@ def test_finalPositionOfStars_onlyDisplayUserStarsInvalidTypes(invalid_input, er
def test_finalPositionOfStars_saveToCsvInvalidTypes(invalid_input, error_output):
with pytest.raises(ValueError, match=re.escape(f"[save_to_csv]: Must be a str, current type = '{error_output}'")):
scsp.finalPositionOfStars(save_to_csv=invalid_input)

def test_finalPositionOfStars_saveToCsvInvalidExtension():
with pytest.raises(ValueError, match=re.escape(f"[save_to_csv]: Extension must be a .csv file, current extension = 'txt'")):
scsp.finalPositionOfStars(save_to_csv="output_file.txt")

0 comments on commit 5fe2e93

Please sign in to comment.