Пример #1
0
    def test_get_headers(self):
        column = SplitExportColumn(
            item=MultipleChoiceItem(
                path=[PathNode(name="form"), PathNode(name="mc")], options=[Option(value="foo"), Option(value="bar")]
            ),
            label="form.mc",
        )
        result = column.get_headers(split_column=True)
        self.assertEqual(result, ["form.mc | foo", "form.mc | bar", "form.mc | extra"])

        result = column.get_headers(split_column=False)
        self.assertEqual(result, ["form.mc"])
Пример #2
0
    def test_get_headers(self):
        column = SplitExportColumn(item=MultipleChoiceItem(
            path=[PathNode(name='form'),
                  PathNode(name='mc')],
            options=[Option(value="foo"),
                     Option(value="bar")]),
                                   label='form.mc')
        result = column.get_headers(split_column=True)
        self.assertEqual(result,
                         ['form.mc | foo', 'form.mc | bar', 'form.mc | extra'])

        result = column.get_headers(split_column=False)
        self.assertEqual(result, ['form.mc'])
Пример #3
0
 def test_basic_get_headers(self):
     column = SplitExportColumn(
         label="Fruit",
         item=MultipleChoiceItem(options=[Option(value="Apple"), Option(value="Banana")]),
         ignore_unspecified_options=True,
     )
     self.assertEqual(column.get_headers(split_column=True), ["Fruit | Apple", "Fruit | Banana"])
Пример #4
0
 def test_get_headers_with_extras(self):
     column = SplitExportColumn(
         label="Fruit - {option}",
         item=MultipleChoiceItem(options=[Option(value="Apple"), Option(value="Banana")]),
         ignore_unspecified_options=False,
     )
     self.assertEqual(column.get_headers(split_column=True), ["Fruit - Apple", "Fruit - Banana", "Fruit - extra"])
Пример #5
0
 def test_get_headers_with_template_string(self):
     column = SplitExportColumn(
         label="Fruit - {option}",
         item=MultipleChoiceItem(
             options=[Option(value='Apple'), Option(value='Banana')]
         ),
         ignore_unspecified_options=True
     )
     self.assertEqual(column.get_headers(split_column=True), ["Fruit - Apple", "Fruit - Banana"])
Пример #6
0
 def test_get_headers_with_extras(self):
     column = SplitExportColumn(
         label="Fruit - {option}",
         item=MultipleChoiceItem(
             options=[Option(value='Apple'),
                      Option(value='Banana')]),
         ignore_unspecified_options=False)
     self.assertEqual(column.get_headers(split_column=True),
                      ["Fruit - Apple", "Fruit - Banana", "Fruit - extra"])
Пример #7
0
 def test_basic_get_headers(self):
     column = SplitExportColumn(
         label="Fruit",
         item=MultipleChoiceItem(
             options=[Option(value='Apple'),
                      Option(value='Banana')]),
         ignore_unspecified_options=True)
     self.assertEqual(column.get_headers(split_column=True),
                      ["Fruit | Apple", "Fruit | Banana"])