Skip to content

Commit

Permalink
Merge pull request #517 from xxyzz/de
Browse files Browse the repository at this point in the history
Fix 'str' object has no attribute 'extend' in de edition page "BU"
  • Loading branch information
xxyzz authored Feb 27, 2024
2 parents 061781b + 670911e commit 90f3df5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/wiktextract/extractor/de/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def process_pos_section(
elif (
isinstance(non_l4_node, WikiNode)
and non_l4_node.kind == NodeKind.TABLE
and "inflection-table" in non_l4_node.attrs.get("class")
and "inflection-table" in non_l4_node.attrs.get("class", "")
):
# XXX: de: Extract html form table
pass
Expand Down
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 90f3df5

Please sign in to comment.