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

Tests in the test suite fail #35

Open
mcepl opened this issue Nov 23, 2023 · 1 comment
Open

Tests in the test suite fail #35

mcepl opened this issue Nov 23, 2023 · 1 comment

Comments

@mcepl
Copy link

mcepl commented Nov 23, 2023

When packaging this package for openSUSE/Tumbleweed (and I have to admit I know almost nothing about the Chinese alphabet, being a Czech myself) the test suite started to fail:

[  103s] =================================== FAILURES ===================================
[  103s] _____________________ TestIdentifyFunctions.test_identify ______________________
[  103s] 
[  103s] self = <dragonmapper.tests.test_transcriptions.TestIdentifyFunctions testMethod=test_identify>
[  103s] 
[  103s]     def test_identify(self):
[  103s] >       self.assertEqual(trans.identify(self.numbered_pinyin), trans.PINYIN)
[  103s] E       AssertionError: 0 != 1
[  103s] 
[  103s] dragonmapper/tests/test_transcriptions.py:19: AssertionError
[  103s] ______________________ TestIdentifyFunctions.test_is_ipa _______________________
[  103s] 
[  103s] self = <dragonmapper.tests.test_transcriptions.TestIdentifyFunctions testMethod=test_is_ipa>
[  103s] 
[  103s]     def test_is_ipa(self):
[  103s] >       self.assertTrue(trans.is_ipa(self.ipa))
[  103s] E       AssertionError: False is not true
[  103s] 
[  103s] dragonmapper/tests/test_transcriptions.py:40: AssertionError
[  103s] _____________________ TestIdentifyFunctions.test_is_pinyin _____________________
[  103s] 
[  103s] self = <dragonmapper.tests.test_transcriptions.TestIdentifyFunctions testMethod=test_is_pinyin>
[  103s] 
[  103s]     def test_is_pinyin(self):
[  103s] >       self.assertTrue(trans.is_pinyin(self.numbered_pinyin))
[  103s] E       AssertionError: False is not true
[  103s] 
[  103s] dragonmapper/tests/test_transcriptions.py:26: AssertionError
[  103s] _______________ TestIdentifyFunctions.test_is_pinyin_compatible ________________
[  103s] 
[  103s] self = <dragonmapper.tests.test_transcriptions.TestIdentifyFunctions testMethod=test_is_pinyin_compatible>
[  103s] 
[  103s]     def test_is_pinyin_compatible(self):
[  103s]         self.assertFalse(trans.is_pinyin_compatible(self.ipa))
[  103s] >       self.assertTrue(trans.is_pinyin_compatible(self.numbered_pinyin))
[  103s] E       AssertionError: False is not true
[  103s] 
[  103s] dragonmapper/tests/test_transcriptions.py:48: AssertionError
[  103s] ________________ TestConvertFunctions.test_accented_to_numbered ________________
[  103s] 
[  103s] self = <dragonmapper.tests.test_transcriptions.TestConvertFunctions testMethod=test_accented_to_numbered>
[  103s] 
[  103s]     def test_accented_to_numbered(self):
[  103s] >       numbered_pinyin = trans.to_pinyin(self.accented_pinyin, accented=False)
[  103s] 
[  103s] dragonmapper/tests/test_transcriptions.py:75: 
[  103s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  103s] 
[  103s] s = 'Wǒ shì yīgè měiguórén.', accented = False
[  103s] 
[  103s]     def to_pinyin(s, accented=True):
[  103s]         """Convert *s* to Pinyin.
[  103s]     
[  103s]         If *accented* is ``True``, diacritics are added to the Pinyin syllables. If
[  103s]         it's ``False``, numbers are used to indicate tone.
[  103s]     
[  103s]         """
[  103s]         identity = identify(s)
[  103s]         if identity == PINYIN:
[  103s]             if _has_accented_vowels(s):
[  103s]                 return s if accented else accented_to_numbered(s)
[  103s]             else:
[  103s]                 return numbered_to_accented(s) if accented else s
[  103s]         elif identity == ZHUYIN:
[  103s]             return zhuyin_to_pinyin(s, accented=accented)
[  103s]         elif identity == IPA:
[  103s]             return ipa_to_pinyin(s, accented=accented)
[  103s]         else:
[  103s] >           raise ValueError("String is not a valid Chinese transcription.")
[  103s] E           ValueError: String is not a valid Chinese transcription.
[  103s] 
[  103s] dragonmapper/transcriptions.py:435: ValueError
[  103s] ________________ TestConvertFunctions.test_numbered_to_accented ________________
[  103s] 
[  103s] self = <dragonmapper.tests.test_transcriptions.TestConvertFunctions testMethod=test_numbered_to_accented>
[  103s] 
[  103s]     def test_numbered_to_accented(self):
[  103s] >       accented_pinyin = trans.to_pinyin(self.numbered_pinyin)
[  103s] 
[  103s] dragonmapper/tests/test_transcriptions.py:71: 
[  103s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  103s] 
[  103s] s = 'Wo3 shi4 yi1ge4 mei3guo2ren2.', accented = True
[  103s] 
[  103s]     def to_pinyin(s, accented=True):
[  103s]         """Convert *s* to Pinyin.
[  103s]     
[  103s]         If *accented* is ``True``, diacritics are added to the Pinyin syllables. If
[  103s]         it's ``False``, numbers are used to indicate tone.
[  103s]     
[  103s]         """
[  103s]         identity = identify(s)
[  103s]         if identity == PINYIN:
[  103s]             if _has_accented_vowels(s):
[  103s]                 return s if accented else accented_to_numbered(s)
[  103s]             else:
[  103s]                 return numbered_to_accented(s) if accented else s
[  103s]         elif identity == ZHUYIN:
[  103s]             return zhuyin_to_pinyin(s, accented=accented)
[  103s]         elif identity == IPA:
[  103s]             return ipa_to_pinyin(s, accented=accented)
[  103s]         else:
[  103s] >           raise ValueError("String is not a valid Chinese transcription.")
[  103s] E           ValueError: String is not a valid Chinese transcription.
[  103s] 
[  103s] dragonmapper/transcriptions.py:435: ValueError
[  103s] =============================== warnings summary ===============================
[  103s] dragonmapper/transcriptions.py:493
[  103s]   /home/abuild/rpmbuild/BUILD/dragonmapper-0.2.6/dragonmapper/transcriptions.py:493: DeprecationWarning: invalid escape sequence \s
[  103s]     re_pattern = '(?:%(syllable)s|\s)+' % {'syllable': zhon.zhuyin.syl}
[  103s] 
[  103s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[  103s] =========================== short test summary info ============================
[  103s] FAILED dragonmapper/tests/test_transcriptions.py::TestIdentifyFunctions::test_identify
[  103s] FAILED dragonmapper/tests/test_transcriptions.py::TestIdentifyFunctions::test_is_ipa
[  103s] FAILED dragonmapper/tests/test_transcriptions.py::TestIdentifyFunctions::test_is_pinyin
[  103s] FAILED dragonmapper/tests/test_transcriptions.py::TestIdentifyFunctions::test_is_pinyin_compatible
[  103s] FAILED dragonmapper/tests/test_transcriptions.py::TestConvertFunctions::test_accented_to_numbered
[  103s] FAILED dragonmapper/tests/test_transcriptions.py::TestConvertFunctions::test_numbered_to_accented
[  103s] =================== 6 failed, 24 passed, 1 warning in 0.54s ====================

Complete build log with all packages installed and steps taken to reproduce.

It is possible that the difference is upgrade of packages this one is dependent on: hanzidentifier-1.1.0 and zhon-2.0.2.

@tsroten
Copy link
Owner

tsroten commented Feb 18, 2024

Hi! The latest version of dragonmapper depends on hanzidentifier 1.2.0+, so you might try updating that package to see if it fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants