Skip to content

Commit

Permalink
Fix 'str' object has no attribute 'extend' in de edition page "BU"
Browse files Browse the repository at this point in the history
Some pages doesn't pass the IPA data to template "Lautschrift" and
the `None` was added to the `ipa` field.
  • Loading branch information
xxyzz committed Feb 26, 2024
1 parent 061781b commit ff2ca12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/wiktextract/extractor/de/pronunciation.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def process_lautschrift_template(
) -> None:
template_parameters = node.template_parameters

ipa = template_parameters.get(1)
ipa = template_parameters.get(1, "")

lang_code = template_parameters.get("spr")
if lang_code:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_de_pronunciation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from wiktextract.extractor.de.pronunciation import (
process_hoerbeispiele,
process_ipa,
process_lautschrift_template,
)
from wiktextract.wxr_context import WiktextractContext

Expand Down Expand Up @@ -178,3 +179,10 @@ def assertSoundDataMatchesExpected(self, sound_data, expected):
self.assertIn(key, exp)
if exp[key] is not None:
self.assertEqual(data[key], exp[key])

def test_empty_ipa_in_lautschrift(self):
self.wxr.wtp.start_page("BU")
root = self.wxr.wtp.parse("{{Lautschrift}}")
sound_data = [Sound()]
process_lautschrift_template(self.wxr, sound_data, root.children[0])
self.assertEqual(sound_data[0].model_dump(exclude_defaults=True), {})

0 comments on commit ff2ca12

Please sign in to comment.