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

Change GERSHAYIM to eng encoding #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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)
Loading