Skip to content

Commit

Permalink
add: test for allowed duplicate choices with translations
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
lindsay-stevens committed Jan 10, 2024
1 parent 2797258 commit 99ebac1
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 | | | |
Expand Down

0 comments on commit 99ebac1

Please sign in to comment.