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')]), ], )
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')]), ], )
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')]), ], )
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')]), ], )
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')]), ], )
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')]), ], )