Skip to content

Commit

Permalink
Merge pull request #212 from HumanSignal/fb-dia-1123
Browse files Browse the repository at this point in the history
fix: DIA-1123: Config with empty string value breaks parser
  • Loading branch information
hakan458 committed May 14, 2024
2 parents effac10 + 899dbd5 commit c477e93
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion label_studio_sdk/label_interface/label_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def parse_node(
parent_name = _get_parent_control_tag_name(tag, controls_context)
if parent_name is not None:
actual_value = tag.attrib.get("alias") or tag.attrib.get("value")
if actual_value:
if actual_value is not None:
return LabelTag(
tag=tag.tag,
attr=dict(tag.attrib),
Expand Down
10 changes: 10 additions & 0 deletions tests/test_interface/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,13 @@
<Rectangle name="{FROM_NAME}" toName="{TO_NAME}"></Rectangle>
</View>
"""

EMPTY_VALUE_CONF = f"""
<View>
<Text name="text" value="$text"/>
<Labels name="type" toName="text">
<Label value="" />
<Label value="" />
</Labels>
</View>
"""
4 changes: 4 additions & 0 deletions tests/test_interface/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,7 @@ def test_load_random_task():

tree = conf.load_task(task)
assert len(tree.get_object(c.TO_NAME).value)


def test_empty_value_config():
conf = LabelInterface(c.EMPTY_VALUE_CONF)

0 comments on commit c477e93

Please sign in to comment.