Skip to content

Commit 07dc412

Browse files
committed
Migrates X-SAMPA test to pytest
1 parent a2cad8e commit 07dc412

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

tests/xsampa_test.py

+14-23
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
1-
import unittest
1+
import pytest
22

33
from citylex import xsampa
44

55

6-
class XSAMPATest(unittest.TestCase):
7-
def test_a(self):
8-
self.assertEqual(xsampa.ipa_to_xsampa("ɑː"), "A:")
9-
10-
def test_ch(self):
11-
self.assertEqual(xsampa.ipa_to_xsampa("t͡ʃ"), "tS")
12-
13-
def test_syllabic_m(self):
14-
self.assertEqual(xsampa.ipa_to_xsampa("m̩"), "m_=")
15-
16-
def test_schwa(self):
17-
self.assertEqual(xsampa.ipa_to_xsampa("ɘ"), "@\\")
18-
19-
def test_y(self):
20-
self.assertEqual(xsampa.ipa_to_xsampa("ʏ"), "Y")
21-
22-
def test_spaces(self):
23-
self.assertEqual(xsampa.ipa_to_xsampa("t͡ʃ ɾ"), "tS 4")
24-
25-
26-
if __name__ == "__main__":
27-
unittest.main()
6+
@pytest.mark.parametrize(
7+
"source,expected",
8+
[
9+
("ɑː", "A:"),
10+
("t͡ʃ", "tS"),
11+
("m̩", "m_="),
12+
("ɘ", "@\\"),
13+
("ʏ", "Y"),
14+
("t͡ʃ ɾ", "tS 4"),
15+
],
16+
)
17+
def test_ipa_to_xsampa(source, expected):
18+
assert xsampa.ipa_to_xsampa(source) == expected

0 commit comments

Comments
 (0)