Skip to content

Commit

Permalink
Change GERSHAYIM to eng encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
NoamNol committed Sep 16, 2024
1 parent 603630f commit 054aacc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ pip install gematriapy

```python
>>> gematriapy.to_hebrew(3, add_gershayim=True)
"ג׳"
"ג'"
```

```python
>>> gematriapy.to_hebrew(766, add_gershayim=True)
"תשס״ו"
'תשס'
```

> **NOTE**: Numbers greater than 999 are not supported yet.
Expand All @@ -46,7 +46,7 @@ pip install gematriapy
```

```python
>>> gematriapy.to_number("ט״ו")
>>> gematriapy.to_number('ט"ו')
15
```

Expand Down
8 changes: 4 additions & 4 deletions gematriapy/gematria.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
}


GERESH = "׳"
GERSHAYIM = "״"
GERESH = "'"
GERSHAYIM = '"'


def to_hebrew(number: int, *, add_gershayim: bool = False) -> str:
Expand All @@ -55,9 +55,9 @@ def to_hebrew(number: int, *, add_gershayim: bool = False) -> str:
With flag `add_gershayim`:
>>> to_hebrew(2, add_gershayim=True)
'ב׳'
"ב'"
>>> to_hebrew(16, add_gershayim=True)
״ז'
"ז'
"""
letters = _simple_to_hebrew(number)
if add_gershayim:
Expand Down
12 changes: 6 additions & 6 deletions tests/test_to_hebrew.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@ def test_too_big(self):
gematriapy.to_hebrew(1000)

def test_add_gershayim_one_letter(self):
self.assertEqual(gematriapy.to_hebrew(3, add_gershayim=True), 'ג׳')
self.assertEqual(gematriapy.to_hebrew(3, add_gershayim=True), "ג'")

def test_add_gershayim_two_letters(self):
self.assertEqual(gematriapy.to_hebrew(13, add_gershayim=True), ״ג')
self.assertEqual(gematriapy.to_hebrew(13, add_gershayim=True), "ג')

def test_add_gershayim_two_letters_value_16_and_17(self):
"""
15 and 16 are a special case in Hebrew.
"""
self.assertEqual(gematriapy.to_hebrew(15, add_gershayim=True), ״ו')
self.assertEqual(gematriapy.to_hebrew(16, add_gershayim=True), ״ז')
self.assertEqual(gematriapy.to_hebrew(15, add_gershayim=True), "ו')
self.assertEqual(gematriapy.to_hebrew(16, add_gershayim=True), "ז')

def test_add_gershayim_three_letters(self):
self.assertEqual(gematriapy.to_hebrew(115, add_gershayim=True), "קט״ו")
self.assertEqual(gematriapy.to_hebrew(115, add_gershayim=True), 'קט"ו')

def test_add_gershayim_four_letters(self):
self.assertEqual(gematriapy.to_hebrew(766, add_gershayim=True), "תשס״ו")
self.assertEqual(gematriapy.to_hebrew(766, add_gershayim=True), 'תשס"ו')
1 change: 1 addition & 0 deletions tests/test_to_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ def test_hebrew_with_nikud(self):

def test_with_gershayim(self):
self.assertEqual(gematriapy.to_number("תשס״ו"), 766)
self.assertEqual(gematriapy.to_number('תשס"ו'), 766)

0 comments on commit 054aacc

Please sign in to comment.