From 054aacc80618267e3c5434162093ac02c04fe04b Mon Sep 17 00:00:00 2001 From: Noam Nol Date: Mon, 16 Sep 2024 23:32:46 +0300 Subject: [PATCH] Change GERSHAYIM to eng encoding --- README.md | 6 +++--- gematriapy/gematria.py | 8 ++++---- tests/test_to_hebrew.py | 12 ++++++------ tests/test_to_number.py | 1 + 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a10fb1b..a71e02e 100644 --- a/README.md +++ b/README.md @@ -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. @@ -46,7 +46,7 @@ pip install gematriapy ``` ```python ->>> gematriapy.to_number("ט״ו") +>>> gematriapy.to_number('ט"ו') 15 ``` diff --git a/gematriapy/gematria.py b/gematriapy/gematria.py index c001f76..eb4fbef 100644 --- a/gematriapy/gematria.py +++ b/gematriapy/gematria.py @@ -37,8 +37,8 @@ } -GERESH = "׳" -GERSHAYIM = "״" +GERESH = "'" +GERSHAYIM = '"' def to_hebrew(number: int, *, add_gershayim: bool = False) -> str: @@ -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: diff --git a/tests/test_to_hebrew.py b/tests/test_to_hebrew.py index ec3ec25..dfad4a5 100644 --- a/tests/test_to_hebrew.py +++ b/tests/test_to_hebrew.py @@ -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), 'תשס"ו') diff --git a/tests/test_to_number.py b/tests/test_to_number.py index 9ad8534..42c699c 100644 --- a/tests/test_to_number.py +++ b/tests/test_to_number.py @@ -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)