def test_get_value(self):
        column = SplitExportColumn(
            item=MultipleChoiceItem(
                path=[PathNode(name='form'), PathNode(name='q1')],
                options=[Option(value='a'), Option(value='c')]
            ),
            ignore_unspecified_options=False
        )
        doc = {"q1": "a b d"}
        self.assertEqual(column.get_value(
            'domain',
            'docid',
            doc,
            [PathNode(name='form')],
            split_column=True),
            [1, EMPTY_VALUE, "b d"]
        )

        doc = {}
        self.assertEqual(
            column.get_value(
                'domain',
                'docid',
                doc,
                [PathNode(name='form')],
                split_column=True
            ),
            [MISSING_VALUE, MISSING_VALUE, MISSING_VALUE]
        )
    def test_get_value(self):
        column = SplitExportColumn(
            item=MultipleChoiceItem(
                path=[PathNode(name="form"), PathNode(name="mc")], options=[Option(value="foo"), Option(value="bar")]
            )
        )
        result = column.get_value("domain", "docid", {"form": {"mc": "foo extra"}}, [], split_column=True)
        self.assertEqual(result, [1, EMPTY_VALUE, "extra"])

        result = column.get_value("domain", "docid", {"form": {"mc": "foo extra"}}, [], split_column=False)
        self.assertEqual(result, "foo extra")
    def test_get_value(self):
        column = SplitExportColumn(
            item=MultipleChoiceItem(
                path=[PathNode(name='form'), PathNode(name='mc')],
                options=[Option(value="foo"), Option(value="bar")]
            ),
        )
        result = column.get_value('domain', 'docid', {'form': {'mc': 'foo extra'}}, [], split_column=True)
        self.assertEqual(result, [1, EMPTY_VALUE, 'extra'])

        result = column.get_value('domain', 'docid', {'form': {'mc': 'foo extra'}}, [], split_column=False)
        self.assertEqual(result, 'foo extra')
 def test_ignore_extas(self):
     column = SplitExportColumn(
         item=MultipleChoiceItem(
             path=[PathNode(name="form"), PathNode(name="q1")], options=[Option(value="a"), Option(value="c")]
         ),
         ignore_unspecified_options=True,
     )
     doc = {"q1": "a b d"}
     self.assertEqual(
         column.get_value("domain", "docid", doc, [PathNode(name="form")], split_column=True), [1, EMPTY_VALUE]
     )
     doc = {}
     self.assertEqual(
         column.get_value("domain", "docid", doc, [PathNode(name="form")], split_column=True),
         [MISSING_VALUE, MISSING_VALUE],
     )
 def test_get_value_numerical(self):
     column = SplitExportColumn(
         item=MultipleChoiceItem(
             path=[PathNode(name="form"), PathNode(name="q1")], options=[Option(value="1"), Option(value="2")]
         ),
         ignore_unspecified_options=False,
     )
     doc = {"q1": 3}
     self.assertEqual(
         column.get_value("domain", "docid", doc, [PathNode(name="form")], split_column=True),
         [EMPTY_VALUE, EMPTY_VALUE, 3],
     )
 def test_ignore_extas(self):
     column = SplitExportColumn(item=MultipleChoiceItem(
         path=[PathNode(name='form'),
               PathNode(name='q1')],
         options=[Option(value='a'), Option(value='c')]),
                                ignore_unspecified_options=True)
     doc = {"q1": "a b d"}
     self.assertEqual(
         column.get_value('domain',
                          'docid',
                          doc, [PathNode(name="form")],
                          split_column=True),
         [1, EMPTY_VALUE],
     )
     doc = {}
     self.assertEqual(
         column.get_value('domain',
                          'docid',
                          doc, [PathNode(name='form')],
                          split_column=True),
         [MISSING_VALUE, MISSING_VALUE])
 def test_get_value_numerical(self):
     column = SplitExportColumn(item=MultipleChoiceItem(
         path=[PathNode(name='form'),
               PathNode(name='q1')],
         options=[Option(value='1'), Option(value='2')]),
                                ignore_unspecified_options=False)
     doc = {"q1": 3}
     self.assertEqual(
         column.get_value('domain',
                          'docid',
                          doc, [PathNode(name='form')],
                          split_column=True), [EMPTY_VALUE, EMPTY_VALUE, 3])
 def test_get_value_numerical(self):
     column = SplitExportColumn(
         item=MultipleChoiceItem(
             path=[PathNode(name='form'), PathNode(name='q1')],
             options=[Option(value='1'), Option(value='2')]
         ),
         ignore_unspecified_options=False
     )
     doc = {"q1": 3}
     self.assertEqual(column.get_value(
         'domain',
         'docid',
         doc,
         [PathNode(name='form')],
         split_column=True),
         [EMPTY_VALUE, EMPTY_VALUE, 3]
     )
 def test_ignore_extas(self):
     column = SplitExportColumn(
         item=MultipleChoiceItem(
             path=[PathNode(name='form'), PathNode(name='q1')],
             options=[Option(value='a'), Option(value='c')]
         ),
         ignore_unspecified_options=True
     )
     doc = {"q1": "a b d"}
     self.assertEqual(column.get_value(
         'domain',
         'docid',
         doc,
         [PathNode(name="form")],
         split_column=True),
         [1, None],
     )