Skip to content

Commit

Permalink
Test 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
graphemecluster committed Jul 18, 2024
1 parent 5f6bd88 commit 09f7d88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Run Python Unit Test
on:
workflow_call:
push:
branches: [main]
branches: [test-prev]

jobs:
test:
Expand All @@ -14,8 +14,20 @@ jobs:
version: ['3.8', '3.10', '3.x']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout 0.3.0
uses: actions/checkout@v4
with:
ref: '0.3.0'
fetch-depth: 0
fetch-tags: true
- name: Checkout latest commit
uses: actions/checkout@v4
with:
path: latest
- shell: bash
run: |
cp -r latest/tests tests/
rm -rf latest
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand Down
5 changes: 0 additions & 5 deletions tests/test_tojyutping.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ def test_get_ipa_candidates(self):
expected = [('咁', ['kɐm˧', 'kɐm˧˥', 'kɐm˥', 'kɐm˨˩']), ('啱', ['ŋaːm˥', 'aːm˥', 'ɐm˥', 'ŋɐm˥']), ('老', ['lou̯˩˧', 'lou̯˧˥']), ('世', ['sɐi̯˧', 'sɐi̯˧˥']), ('要', ['jiːu̯˥', 'jiːu̯˧', 'jiːu̯˧˥']), ('求', ['kʰɐu̯˨˩']), ('佢', ['kʰɵy̑˩˧', 'hɵy̑˩˧']), ('等', ['tɐŋ˧˥']), ('陣', ['t͡sɐn˨', 't͡sɐn˧˥']), ('要', ['jiːu̯˧', 'jiːu̯˧˥', 'jiːu̯˥']), ('開', ['hɔːi̯˥']), ('會', ['wuːi̯˧˥', 'wuːi̯˩˧', 'wuːi̯˨', 'wuːi̯˧', 'kʰuːi̯˧˥', 'kʰuːi̯˧', 'kʷʰuːi̯˧˥']), (',', []), ('剩', ['t͡seŋ˨', 'seŋ˨']), ('低', ['tɐi̯˥']), ('嘅', ['kɛː˧', 'kɛː˧˥', 'kʰɔːi̯˧˥', 'kʰɔːi̯˧']), ('嘢', ['jɛː˩˧', 'ɛː˩˧']), ('我', ['ŋɔː˩˧', 'ɔː˩˧']), ('會', ['wuːi̯˩˧', 'wuːi̯˨', 'wuːi̯˧˥', 'wuːi̯˧', 'kʰuːi̯˧˥', 'kʰuːi̯˧', 'kʷʰuːi̯˧˥']), ('搞', ['kaːu̯˧˥']), ('掂', ['tiːm˨', 'tiːm˧', 'tiːm˥']), ('㗎', ['kaː˧', 'kɐ˧', 'kaː˧˥', 'kaː˥', 'kaː˨˩']), ('喇', ['laː˧', 'laː˥', 'laːk̚˧', 'laː˩˧', 'laːt̚˧']), ('。', [])]
self.assertEqual(result, expected)

def test_g2p(self):
result = ToJyutping.g2p(self.test_string)
expected = [(9, 32, 89), (11, 23, 87), (8, 58, 91), (18, 30, 89), (19, 49, 87), (10, 31, 90), (10, 79, 91), (5, 34, 88), (16, 33, 92), (19, 49, 89), (15, 57, 87), (14, 66, 88), (16, 52, 92), (5, 30, 87), (9, 38, 89), (19, 38, 91), (11, 56, 91), (14, 66, 91), (9, 22, 88), (5, 50, 92), (9, 20, 89), (8, 20, 89)]
self.assertEqual(result, expected)

def test_jyutping2ipa(self):
result = ToJyutping.jyutping2ipa("cin1 ngaa5")
expected = "t͡sʰiːn˥.ŋaː˩˧"
Expand Down

0 comments on commit 09f7d88

Please sign in to comment.