From 99ebac1ef76a23526a112c5a882cb91d3a3f4e4c Mon Sep 17 00:00:00 2001 From: lindsay stevens Date: Wed, 10 Jan 2024 21:38:30 +1100 Subject: [PATCH] add: test for allowed duplicate choices with translations - prior to always generating secondary instances, this scenario would have not output the duplicate choices, even if allowed. Now, itext are identified by choice position so it's not a problem. This test adds to the existing suite by using translations with the duplicates. --- tests/test_fields.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/test_fields.py b/tests/test_fields.py index 0bbef64d..d124f92b 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -126,6 +126,39 @@ def test_duplicate_choices_with_allow_choice_duplicates_setting(self): ], ) + def test_duplicate_choices_with_allow_choice_duplicates_setting_and_translations( + self, + ): + md = """ + | survey | | | | + | | type | name | label::en | label::ko | + | | select_one list | S1 | s1 | 질문 1 | + | choices | | | | + | | list name | name | label::en | label::ko | + | | list | a | Pass | 패스 | + | | list | b | Fail | 실패 | + | | list | c | Skipped | 건너뛴 | + | | list | c | Not Applicable | 해당 없음 | + | settings | | | + | | id_string | allow_choice_duplicates | + | | Duplicates | Yes | + """ + self.assertPyxformXform( + md=md, + xml__xpath_match=[ + xpc.model_itext_choice_text_label_by_pos( + "en", + "list", + ("Pass", "Fail", "Skipped", "Not Applicable"), + ), + xpc.model_itext_choice_text_label_by_pos( + "ko", + "list", + ("패스", "실패", "건너뛴", "해당 없음"), + ), + ], + ) + def test_choice_list_without_duplicates_is_successful(self): md = """ | survey | | | |