Пример #1
0
    def test_different_doc_types_ordering(self):
        schema = self._create_schema([
            GeopointItem(path=[PathNode(name='one')]),
            ScalarItem(path=[PathNode(name='two')]),
            ScalarItem(path=[PathNode(name='three')]),
            ScalarItem(path=[PathNode(name='one')]),
        ])

        ordered_schema = self._create_schema([
            ScalarItem(path=[PathNode(name='two')]),
            ScalarItem(path=[PathNode(name='one')]),
            ScalarItem(path=[PathNode(name='three')]),
            GeopointItem(path=[PathNode(name='one')]),
        ])

        schema = CaseExportDataSchema._reorder_schema_from_schema(
            schema,
            ordered_schema,
        )
        self._assert_item_order(
            schema,
            [],
            [
                ScalarItem(path=[PathNode(name='two')]),
                ScalarItem(path=[PathNode(name='one')]),
                ScalarItem(path=[PathNode(name='three')]),
                GeopointItem(path=[PathNode(name='one')]),
            ],
        )
Пример #2
0
    def test_partial_match_ordering(self):
        schema = self._create_schema([
            ExportItem(path=[PathNode(name='two')]),
            ExportItem(path=[PathNode(name='one')]),
            ExportItem(path=[PathNode(name='three')]),
        ])

        ordered_schema = self._create_schema([
            ExportItem(path=[PathNode(name='one')]),
            ExportItem(path=[PathNode(name='four')]),
            ExportItem(path=[PathNode(name='five')]),
            ExportItem(path=[PathNode(name='six')]),
        ])

        schema = CaseExportDataSchema._reorder_schema_from_schema(
            schema,
            ordered_schema,
        )
        self._assert_item_order(
            schema,
            [],
            [
                ExportItem(path=[PathNode(name='one')]),
                ExportItem(path=[PathNode(name='two')]),
                ExportItem(path=[PathNode(name='three')]),
            ],
        )
Пример #3
0
    def test_basic_ordering(self):
        schema = self._create_schema([
            ScalarItem(path=[PathNode(name='three')]),
            ScalarItem(path=[PathNode(name='one')]),
            ScalarItem(path=[PathNode(name='two')]),
            ScalarItem(path=[PathNode(name='four')]),
        ])

        ordered_schema = self._create_schema([
            ScalarItem(path=[PathNode(name='one')]),
            ScalarItem(path=[PathNode(name='two')]),
            ScalarItem(path=[PathNode(name='three')]),
            ScalarItem(path=[PathNode(name='four')]),
        ])

        schema = CaseExportDataSchema._reorder_schema_from_schema(
            schema,
            ordered_schema,
        )
        self._assert_item_order(
            schema,
            [],
            [
                ScalarItem(path=[PathNode(name='one')]),
                ScalarItem(path=[PathNode(name='two')]),
                ScalarItem(path=[PathNode(name='three')]),
                ScalarItem(path=[PathNode(name='four')]),
            ],
        )
Пример #4
0
    def test_different_doc_types_ordering(self):
        schema = self._create_schema([
            GeopointItem(path=[PathNode(name='one')]),
            ScalarItem(path=[PathNode(name='two')]),
            ScalarItem(path=[PathNode(name='three')]),
            ScalarItem(path=[PathNode(name='one')]),
        ])

        ordered_schema = self._create_schema([
            ScalarItem(path=[PathNode(name='two')]),
            ScalarItem(path=[PathNode(name='one')]),
            ScalarItem(path=[PathNode(name='three')]),
            GeopointItem(path=[PathNode(name='one')]),
        ])

        schema = CaseExportDataSchema._reorder_schema_from_schema(
            schema,
            ordered_schema,
        )
        self._assert_item_order(
            schema,
            [],
            [
                ScalarItem(path=[PathNode(name='two')]),
                ScalarItem(path=[PathNode(name='one')]),
                ScalarItem(path=[PathNode(name='three')]),
                GeopointItem(path=[PathNode(name='one')]),
            ],
        )
Пример #5
0
    def test_partial_match_ordering(self):
        schema = self._create_schema([
            ExportItem(path=[PathNode(name='two')]),
            ExportItem(path=[PathNode(name='one')]),
            ExportItem(path=[PathNode(name='three')]),
        ])

        ordered_schema = self._create_schema([
            ExportItem(path=[PathNode(name='one')]),
            ExportItem(path=[PathNode(name='four')]),
            ExportItem(path=[PathNode(name='five')]),
            ExportItem(path=[PathNode(name='six')]),
        ])

        schema = CaseExportDataSchema._reorder_schema_from_schema(
            schema,
            ordered_schema,
        )
        self._assert_item_order(
            schema,
            [],
            [
                ExportItem(path=[PathNode(name='one')]),
                ExportItem(path=[PathNode(name='two')]),
                ExportItem(path=[PathNode(name='three')]),
            ],
        )
Пример #6
0
    def test_basic_ordering(self):
        schema = self._create_schema([
            ScalarItem(path=[PathNode(name='three')]),
            ScalarItem(path=[PathNode(name='one')]),
            ScalarItem(path=[PathNode(name='two')]),
            ScalarItem(path=[PathNode(name='four')]),
        ])

        ordered_schema = self._create_schema([
            ScalarItem(path=[PathNode(name='one')]),
            ScalarItem(path=[PathNode(name='two')]),
            ScalarItem(path=[PathNode(name='three')]),
            ScalarItem(path=[PathNode(name='four')]),
        ])

        schema = CaseExportDataSchema._reorder_schema_from_schema(
            schema,
            ordered_schema,
        )
        self._assert_item_order(
            schema,
            [],
            [
                ScalarItem(path=[PathNode(name='one')]),
                ScalarItem(path=[PathNode(name='two')]),
                ScalarItem(path=[PathNode(name='three')]),
                ScalarItem(path=[PathNode(name='four')]),
            ],
        )