nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: XLSForm/pyxform
Pull request #92 (2016-10-26 10:42:11)

fix for intent values


Patch:
diff --git a/pyxform/xls2json.py b/pyxform/xls2json.py
index 4bbba0b..9cb6163 100644
--- a/pyxform/xls2json.py
+++ b/pyxform/xls2json.py
@@ -598,6 +598,11 @@ def workbook_to_json(
                                 new_json_dict['hint']
                             del new_json_dict['hint']
                         child_list.append(generated_label_element)
+                if 'intent' in new_json_dict:
+                    new_json_dict['control'] = \
+                        new_json_dict.get(u"control", {})
+                    new_json_dict['control']['intent'] = \
+                        new_json_dict['intent']
 
                 parent_children_array.append(new_json_dict)
                 stack.append((control_type, child_list))


Test patch:
diff --git a/pyxform/tests_v1/test_groups.py b/pyxform/tests_v1/test_groups.py
index 3019b5e..b0a6254 100644
--- a/pyxform/tests_v1/test_groups.py
+++ b/pyxform/tests_v1/test_groups.py
@@ -24,3 +24,20 @@ class GroupsTests(PyxformTestCase):
                 '</xgrp>',
                 '<postgrp/>',
                 ])
+
+    def test_group_intent(self):
+        self.assertPyxformXform(
+            name="intent_test",
+            md="""
+            | survey |             |         |                  |                                                             |
+            |        | type        | name    | label            | intent                                                      |
+            |        | text        | pregrp  | Pregroup text    |                                                             |
+            |        | begin group | xgrp    | XGroup questions | ex:org.redcross.openmapkit.action.QUERY(osm_file=${pregrp}) |
+            |        | text        | xgrp_q1 | XGroup Q1        |                                                             |
+            |        | integer     | xgrp_q2 | XGroup Q2        |                                                             |
+            |        | end group   |         |                  |                                                             |
+            |        | note        | postgrp | Post group note  |                                                             |
+            """,  # nopep8
+            xml__contains=[
+                '<group intent="ex:org.redcross.openmapkit.action.QUERY(osm_file= /intent_test/pregrp )" ref="/intent_test/xgrp">',  # nopep8
+                ])