Пример #1
0
    def test_get_value_missing_index(self):
        doc = {"indices": []}
        doc2 = {}

        item = CaseIndexItem(path=[PathNode(name="indices"), PathNode(name="RegCase")])
        col = CaseIndexExportColumn(item=item)

        self.assertEqual(col.get_value("domain", "docid", doc, []), EMPTY_VALUE)
        self.assertEqual(col.get_value("domain", "docid", doc2, []), EMPTY_VALUE)
Пример #2
0
    def test_get_value_missing_index(self):
        doc = {
            'indices': []
        }
        doc2 = {}

        item = CaseIndexItem(path=[PathNode(name='indices'), PathNode(name='RegCase')])
        col = CaseIndexExportColumn(item=item)

        self.assertEqual(col.get_value('domain', 'docid', doc, []), EMPTY_VALUE)
        self.assertEqual(col.get_value('domain', 'docid', doc2, []), EMPTY_VALUE)
Пример #3
0
    def test_get_value_missing_index(self):
        doc = {'indices': []}
        doc2 = {}

        item = CaseIndexItem(
            path=[PathNode(name='indices'),
                  PathNode(name='RegCase')])
        col = CaseIndexExportColumn(item=item)

        self.assertEqual(col.get_value('domain', 'docid', doc, []), '')
        self.assertEqual(col.get_value('domain', 'docid', doc2, []), '')
Пример #4
0
 def test_get_value(self):
     doc = {
         "indices": [
             {"referenced_id": "abc", "referenced_type": "RegCase"},
             {"referenced_id": "def", "referenced_type": "RegCase"},
             {"referenced_id": "notme", "referenced_type": "OtherCase"},
         ]
     }
     item = CaseIndexItem(path=[PathNode(name="indices"), PathNode(name="RegCase")])
     col = CaseIndexExportColumn(item=item)
     self.assertEqual(col.get_value("domain", "docid", doc, []), "abc def")
Пример #5
0
 def test_get_value(self):
     doc = {
         'indices': [
             {
                 'referenced_id': 'abc',
                 'referenced_type': 'RegCase',
             },
             {
                 'referenced_id': 'def',
                 'referenced_type': 'RegCase',
             },
             {
                 'referenced_id': 'notme',
                 'referenced_type': 'OtherCase',
             },
         ]
     }
     item = CaseIndexItem(path=[PathNode(name='indices'), PathNode(name='RegCase')])
     col = CaseIndexExportColumn(item=item)
     self.assertEqual(col.get_value('domain', 'docid', doc, []), 'abc def')
Пример #6
0
 def test_get_value(self):
     doc = {
         'indices': [
             {
                 'referenced_id': 'abc',
                 'referenced_type': 'RegCase',
             },
             {
                 'referenced_id': 'def',
                 'referenced_type': 'RegCase',
             },
             {
                 'referenced_id': 'notme',
                 'referenced_type': 'OtherCase',
             },
         ]
     }
     item = CaseIndexItem(path=[PathNode(name='indices'), PathNode(name='RegCase')])
     col = CaseIndexExportColumn(item=item)
     self.assertEqual(col.get_value('domain', 'docid', doc, []), 'abc def')