Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ValueError in to_hebrew #7

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gematriapy/gematria.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def to_hebrew(number: int) -> str:
to_hebrew(47) # => "מז"
"""
if number <= 0:
raise Exception("Number must be bigger than zero")
raise ValueError("Number must be bigger than zero")
if number >= 1000:
raise Exception("Number bigger than 999 is not yet supported")
raise ValueError("Number bigger than 999 is not yet supported")

remainder = number
heb_sum = ""
Expand Down
6 changes: 3 additions & 3 deletions tests/test_to_hebrew.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def test_hundreds_num_that_ends_with_16(self):
self.assertEqual(gematriapy.to_hebrew(516), "תקטז")

def test_zero(self):
with self.assertRaises(Exception):
with self.assertRaises(ValueError):
gematriapy.to_hebrew(0)

def test_negative(self):
with self.assertRaises(Exception):
with self.assertRaises(ValueError):
gematriapy.to_hebrew(-1)

def test_too_big(self):
with self.assertRaises(Exception):
with self.assertRaises(ValueError):
gematriapy.to_hebrew(1000)
Loading