From c82d6729410ab9ba4ba7ca66b7259299a8bc7dae Mon Sep 17 00:00:00 2001 From: Angelo Paparazzi Date: Thu, 22 Feb 2024 16:48:08 -0600 Subject: [PATCH] feat(disco-v2): class changes --- ibm_watson/discovery_v2.py | 576 +++++---------------------------- test/unit/test_discovery_v2.py | 451 +++++++++----------------- 2 files changed, 242 insertions(+), 785 deletions(-) diff --git a/ibm_watson/discovery_v2.py b/ibm_watson/discovery_v2.py index ba7aba4c..3bfead3d 100644 --- a/ibm_watson/discovery_v2.py +++ b/ibm_watson/discovery_v2.py @@ -10976,18 +10976,18 @@ class TableBodyCells: `column` location in the current table. :param int column_index_end: (optional) The `end` index of this cell's `column` location in the current table. - :param List[TableRowHeaderIds] row_header_ids: (optional) A list of table row - header ids. - :param List[TableRowHeaderTexts] row_header_texts: (optional) A list of table - row header texts. - :param List[TableRowHeaderTextsNormalized] row_header_texts_normalized: - (optional) A list of table row header texts normalized. - :param List[TableColumnHeaderIds] column_header_ids: (optional) A list of table - column header ids. - :param List[TableColumnHeaderTexts] column_header_texts: (optional) A list of - table column header texts. - :param List[TableColumnHeaderTextsNormalized] column_header_texts_normalized: - (optional) A list of table column header texts normalized. + :param List[str] row_header_ids: (optional) A list of ID values that represent + the table row headers that are associated with this body cell. + :param List[str] row_header_texts: (optional) A list of row header values that + are associated with this body cell. + :param List[str] row_header_texts_normalized: (optional) A list of normalized + row header values that are associated with this body cell. + :param List[str] column_header_ids: (optional) A list of ID values that + represent the column headers that are associated with this body cell. + :param List[str] column_header_texts: (optional) A list of column header values + that are associated with this body cell. + :param List[str] column_header_texts_normalized: (optional) A list of normalized + column header values that are associated with this body cell. :param List[DocumentAttribute] attributes: (optional) A list of document attributes. """ @@ -11002,14 +11002,12 @@ def __init__( row_index_end: Optional[int] = None, column_index_begin: Optional[int] = None, column_index_end: Optional[int] = None, - row_header_ids: Optional[List['TableRowHeaderIds']] = None, - row_header_texts: Optional[List['TableRowHeaderTexts']] = None, - row_header_texts_normalized: Optional[ - List['TableRowHeaderTextsNormalized']] = None, - column_header_ids: Optional[List['TableColumnHeaderIds']] = None, - column_header_texts: Optional[List['TableColumnHeaderTexts']] = None, - column_header_texts_normalized: Optional[ - List['TableColumnHeaderTextsNormalized']] = None, + row_header_ids: Optional[List[str]] = None, + row_header_texts: Optional[List[str]] = None, + row_header_texts_normalized: Optional[List[str]] = None, + column_header_ids: Optional[List[str]] = None, + column_header_texts: Optional[List[str]] = None, + column_header_texts_normalized: Optional[List[str]] = None, attributes: Optional[List['DocumentAttribute']] = None, ) -> None: """ @@ -11030,19 +11028,18 @@ def __init__( `column` location in the current table. :param int column_index_end: (optional) The `end` index of this cell's `column` location in the current table. - :param List[TableRowHeaderIds] row_header_ids: (optional) A list of table - row header ids. - :param List[TableRowHeaderTexts] row_header_texts: (optional) A list of - table row header texts. - :param List[TableRowHeaderTextsNormalized] row_header_texts_normalized: - (optional) A list of table row header texts normalized. - :param List[TableColumnHeaderIds] column_header_ids: (optional) A list of - table column header ids. - :param List[TableColumnHeaderTexts] column_header_texts: (optional) A list - of table column header texts. - :param List[TableColumnHeaderTextsNormalized] - column_header_texts_normalized: (optional) A list of table column header - texts normalized. + :param List[str] row_header_ids: (optional) A list of ID values that + represent the table row headers that are associated with this body cell. + :param List[str] row_header_texts: (optional) A list of row header values + that are associated with this body cell. + :param List[str] row_header_texts_normalized: (optional) A list of + normalized row header values that are associated with this body cell. + :param List[str] column_header_ids: (optional) A list of ID values that + represent the column headers that are associated with this body cell. + :param List[str] column_header_texts: (optional) A list of column header + values that are associated with this body cell. + :param List[str] column_header_texts_normalized: (optional) A list of + normalized column header values that are associated with this body cell. :param List[DocumentAttribute] attributes: (optional) A list of document attributes. """ @@ -11080,34 +11077,21 @@ def from_dict(cls, _dict: Dict) -> 'TableBodyCells': if (column_index_end := _dict.get('column_index_end')) is not None: args['column_index_end'] = column_index_end if (row_header_ids := _dict.get('row_header_ids')) is not None: - args['row_header_ids'] = [ - TableRowHeaderIds.from_dict(v) for v in row_header_ids - ] + args['row_header_ids'] = row_header_ids if (row_header_texts := _dict.get('row_header_texts')) is not None: - args['row_header_texts'] = [ - TableRowHeaderTexts.from_dict(v) for v in row_header_texts - ] + args['row_header_texts'] = row_header_texts if (row_header_texts_normalized := _dict.get('row_header_texts_normalized')) is not None: - args['row_header_texts_normalized'] = [ - TableRowHeaderTextsNormalized.from_dict(v) - for v in row_header_texts_normalized - ] + args['row_header_texts_normalized'] = row_header_texts_normalized if (column_header_ids := _dict.get('column_header_ids')) is not None: - args['column_header_ids'] = [ - TableColumnHeaderIds.from_dict(v) for v in column_header_ids - ] + args['column_header_ids'] = column_header_ids if (column_header_texts := _dict.get('column_header_texts')) is not None: - args['column_header_texts'] = [ - TableColumnHeaderTexts.from_dict(v) for v in column_header_texts - ] + args['column_header_texts'] = column_header_texts if (column_header_texts_normalized := _dict.get('column_header_texts_normalized')) is not None: - args['column_header_texts_normalized'] = [ - TableColumnHeaderTextsNormalized.from_dict(v) - for v in column_header_texts_normalized - ] + args[ + 'column_header_texts_normalized'] = column_header_texts_normalized if (attributes := _dict.get('attributes')) is not None: args['attributes'] = [ DocumentAttribute.from_dict(v) for v in attributes @@ -11144,61 +11128,25 @@ def to_dict(self) -> Dict: 'column_index_end') and self.column_index_end is not None: _dict['column_index_end'] = self.column_index_end if hasattr(self, 'row_header_ids') and self.row_header_ids is not None: - row_header_ids_list = [] - for v in self.row_header_ids: - if isinstance(v, dict): - row_header_ids_list.append(v) - else: - row_header_ids_list.append(v.to_dict()) - _dict['row_header_ids'] = row_header_ids_list + _dict['row_header_ids'] = self.row_header_ids if hasattr(self, 'row_header_texts') and self.row_header_texts is not None: - row_header_texts_list = [] - for v in self.row_header_texts: - if isinstance(v, dict): - row_header_texts_list.append(v) - else: - row_header_texts_list.append(v.to_dict()) - _dict['row_header_texts'] = row_header_texts_list + _dict['row_header_texts'] = self.row_header_texts if hasattr(self, 'row_header_texts_normalized' ) and self.row_header_texts_normalized is not None: - row_header_texts_normalized_list = [] - for v in self.row_header_texts_normalized: - if isinstance(v, dict): - row_header_texts_normalized_list.append(v) - else: - row_header_texts_normalized_list.append(v.to_dict()) _dict[ - 'row_header_texts_normalized'] = row_header_texts_normalized_list + 'row_header_texts_normalized'] = self.row_header_texts_normalized if hasattr(self, 'column_header_ids') and self.column_header_ids is not None: - column_header_ids_list = [] - for v in self.column_header_ids: - if isinstance(v, dict): - column_header_ids_list.append(v) - else: - column_header_ids_list.append(v.to_dict()) - _dict['column_header_ids'] = column_header_ids_list + _dict['column_header_ids'] = self.column_header_ids if hasattr( self, 'column_header_texts') and self.column_header_texts is not None: - column_header_texts_list = [] - for v in self.column_header_texts: - if isinstance(v, dict): - column_header_texts_list.append(v) - else: - column_header_texts_list.append(v.to_dict()) - _dict['column_header_texts'] = column_header_texts_list + _dict['column_header_texts'] = self.column_header_texts if hasattr(self, 'column_header_texts_normalized' ) and self.column_header_texts_normalized is not None: - column_header_texts_normalized_list = [] - for v in self.column_header_texts_normalized: - if isinstance(v, dict): - column_header_texts_normalized_list.append(v) - else: - column_header_texts_normalized_list.append(v.to_dict()) _dict[ - 'column_header_texts_normalized'] = column_header_texts_normalized_list + 'column_header_texts_normalized'] = self.column_header_texts_normalized if hasattr(self, 'attributes') and self.attributes is not None: attributes_list = [] for v in self.attributes: @@ -11394,200 +11342,18 @@ def __ne__(self, other: 'TableCellValues') -> bool: return not self == other -class TableColumnHeaderIds: - """ - An array of values, each being the `id` value of a column header that is applicable to - the current cell. - - :param str id: (optional) The `id` value of a column header. - """ - - def __init__( - self, - *, - id: Optional[str] = None, - ) -> None: - """ - Initialize a TableColumnHeaderIds object. - - :param str id: (optional) The `id` value of a column header. - """ - self.id = id - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TableColumnHeaderIds': - """Initialize a TableColumnHeaderIds object from a json dictionary.""" - args = {} - if (id := _dict.get('id')) is not None: - args['id'] = id - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TableColumnHeaderIds object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TableColumnHeaderIds object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TableColumnHeaderIds') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TableColumnHeaderIds') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class TableColumnHeaderTexts: - """ - An array of values, each being the `text` value of a column header that is applicable - to the current cell. - - :param str text: (optional) The `text` value of a column header. - """ - - def __init__( - self, - *, - text: Optional[str] = None, - ) -> None: - """ - Initialize a TableColumnHeaderTexts object. - - :param str text: (optional) The `text` value of a column header. - """ - self.text = text - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TableColumnHeaderTexts': - """Initialize a TableColumnHeaderTexts object from a json dictionary.""" - args = {} - if (text := _dict.get('text')) is not None: - args['text'] = text - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TableColumnHeaderTexts object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'text') and self.text is not None: - _dict['text'] = self.text - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TableColumnHeaderTexts object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TableColumnHeaderTexts') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TableColumnHeaderTexts') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class TableColumnHeaderTextsNormalized: - """ - If you provide customization input, the normalized version of the column header texts - according to the customization; otherwise, the same value as `column_header_texts`. - - :param str text_normalized: (optional) The normalized version of a column header - text. - """ - - def __init__( - self, - *, - text_normalized: Optional[str] = None, - ) -> None: - """ - Initialize a TableColumnHeaderTextsNormalized object. - - :param str text_normalized: (optional) The normalized version of a column - header text. - """ - self.text_normalized = text_normalized - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TableColumnHeaderTextsNormalized': - """Initialize a TableColumnHeaderTextsNormalized object from a json dictionary.""" - args = {} - if (text_normalized := _dict.get('text_normalized')) is not None: - args['text_normalized'] = text_normalized - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TableColumnHeaderTextsNormalized object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, - 'text_normalized') and self.text_normalized is not None: - _dict['text_normalized'] = self.text_normalized - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TableColumnHeaderTextsNormalized object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TableColumnHeaderTextsNormalized') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TableColumnHeaderTextsNormalized') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class TableColumnHeaders: """ Column-level cells, each applicable as a header to other cells in the same column as itself, of the current table. :param str cell_id: (optional) The unique ID of the cell in the current table. - :param dict location: (optional) The location of the column header cell in the - current table as defined by its `begin` and `end` offsets, respectfully, in the - input document. + :param TableElementLocation location: (optional) The numeric location of the + identified element in the document, represented with two integers labeled + `begin` and `end`. :param str text: (optional) The textual contents of this cell from the input document without associated markup content. - :param str text_normalized: (optional) If you provide customization input, the - normalized version of the cell text according to the customization; otherwise, - the same value as `text`. + :param str text_normalized: (optional) Normalized column header text. :param int row_index_begin: (optional) The `begin` index of this cell's `row` location in the current table. :param int row_index_end: (optional) The `end` index of this cell's `row` @@ -11602,7 +11368,7 @@ def __init__( self, *, cell_id: Optional[str] = None, - location: Optional[dict] = None, + location: Optional['TableElementLocation'] = None, text: Optional[str] = None, text_normalized: Optional[str] = None, row_index_begin: Optional[int] = None, @@ -11615,14 +11381,12 @@ def __init__( :param str cell_id: (optional) The unique ID of the cell in the current table. - :param dict location: (optional) The location of the column header cell in - the current table as defined by its `begin` and `end` offsets, - respectfully, in the input document. + :param TableElementLocation location: (optional) The numeric location of + the identified element in the document, represented with two integers + labeled `begin` and `end`. :param str text: (optional) The textual contents of this cell from the input document without associated markup content. - :param str text_normalized: (optional) If you provide customization input, - the normalized version of the cell text according to the customization; - otherwise, the same value as `text`. + :param str text_normalized: (optional) Normalized column header text. :param int row_index_begin: (optional) The `begin` index of this cell's `row` location in the current table. :param int row_index_end: (optional) The `end` index of this cell's `row` @@ -11648,7 +11412,7 @@ def from_dict(cls, _dict: Dict) -> 'TableColumnHeaders': if (cell_id := _dict.get('cell_id')) is not None: args['cell_id'] = cell_id if (location := _dict.get('location')) is not None: - args['location'] = location + args['location'] = TableElementLocation.from_dict(location) if (text := _dict.get('text')) is not None: args['text'] = text if (text_normalized := _dict.get('text_normalized')) is not None: @@ -11674,7 +11438,10 @@ def to_dict(self) -> Dict: if hasattr(self, 'cell_id') and self.cell_id is not None: _dict['cell_id'] = self.cell_id if hasattr(self, 'location') and self.location is not None: - _dict['location'] = self.location + if isinstance(self.location, dict): + _dict['location'] = self.location + else: + _dict['location'] = self.location.to_dict() if hasattr(self, 'text') and self.text is not None: _dict['text'] = self.text if hasattr(self, @@ -11792,9 +11559,9 @@ class TableHeaders: The contents of the current table's header. :param str cell_id: (optional) The unique ID of the cell in the current table. - :param dict location: (optional) The location of the table header cell in the - current table as defined by its `begin` and `end` offsets, respectfully, in the - input document. + :param TableElementLocation location: (optional) The numeric location of the + identified element in the document, represented with two integers labeled + `begin` and `end`. :param str text: (optional) The textual contents of the cell from the input document without associated markup content. :param int row_index_begin: (optional) The `begin` index of this cell's `row` @@ -11811,7 +11578,7 @@ def __init__( self, *, cell_id: Optional[str] = None, - location: Optional[dict] = None, + location: Optional['TableElementLocation'] = None, text: Optional[str] = None, row_index_begin: Optional[int] = None, row_index_end: Optional[int] = None, @@ -11823,9 +11590,9 @@ def __init__( :param str cell_id: (optional) The unique ID of the cell in the current table. - :param dict location: (optional) The location of the table header cell in - the current table as defined by its `begin` and `end` offsets, - respectfully, in the input document. + :param TableElementLocation location: (optional) The numeric location of + the identified element in the document, represented with two integers + labeled `begin` and `end`. :param str text: (optional) The textual contents of the cell from the input document without associated markup content. :param int row_index_begin: (optional) The `begin` index of this cell's @@ -11852,7 +11619,7 @@ def from_dict(cls, _dict: Dict) -> 'TableHeaders': if (cell_id := _dict.get('cell_id')) is not None: args['cell_id'] = cell_id if (location := _dict.get('location')) is not None: - args['location'] = location + args['location'] = TableElementLocation.from_dict(location) if (text := _dict.get('text')) is not None: args['text'] = text if (row_index_begin := _dict.get('row_index_begin')) is not None: @@ -11876,7 +11643,10 @@ def to_dict(self) -> Dict: if hasattr(self, 'cell_id') and self.cell_id is not None: _dict['cell_id'] = self.cell_id if hasattr(self, 'location') and self.location is not None: - _dict['location'] = self.location + if isinstance(self.location, dict): + _dict['location'] = self.location + else: + _dict['location'] = self.location.to_dict() if hasattr(self, 'text') and self.text is not None: _dict['text'] = self.text if hasattr(self, @@ -12206,186 +11976,6 @@ def __ne__(self, other: 'TableResultTable') -> bool: return not self == other -class TableRowHeaderIds: - """ - An array of values, each being the `id` value of a row header that is applicable to - this body cell. - - :param str id: (optional) The `id` values of a row header. - """ - - def __init__( - self, - *, - id: Optional[str] = None, - ) -> None: - """ - Initialize a TableRowHeaderIds object. - - :param str id: (optional) The `id` values of a row header. - """ - self.id = id - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TableRowHeaderIds': - """Initialize a TableRowHeaderIds object from a json dictionary.""" - args = {} - if (id := _dict.get('id')) is not None: - args['id'] = id - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TableRowHeaderIds object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TableRowHeaderIds object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TableRowHeaderIds') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TableRowHeaderIds') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class TableRowHeaderTexts: - """ - An array of values, each being the `text` value of a row header that is applicable to - this body cell. - - :param str text: (optional) The `text` value of a row header. - """ - - def __init__( - self, - *, - text: Optional[str] = None, - ) -> None: - """ - Initialize a TableRowHeaderTexts object. - - :param str text: (optional) The `text` value of a row header. - """ - self.text = text - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TableRowHeaderTexts': - """Initialize a TableRowHeaderTexts object from a json dictionary.""" - args = {} - if (text := _dict.get('text')) is not None: - args['text'] = text - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TableRowHeaderTexts object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'text') and self.text is not None: - _dict['text'] = self.text - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TableRowHeaderTexts object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TableRowHeaderTexts') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TableRowHeaderTexts') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class TableRowHeaderTextsNormalized: - """ - If you provide customization input, the normalized version of the row header texts - according to the customization; otherwise, the same value as `row_header_texts`. - - :param str text_normalized: (optional) The normalized version of a row header - text. - """ - - def __init__( - self, - *, - text_normalized: Optional[str] = None, - ) -> None: - """ - Initialize a TableRowHeaderTextsNormalized object. - - :param str text_normalized: (optional) The normalized version of a row - header text. - """ - self.text_normalized = text_normalized - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TableRowHeaderTextsNormalized': - """Initialize a TableRowHeaderTextsNormalized object from a json dictionary.""" - args = {} - if (text_normalized := _dict.get('text_normalized')) is not None: - args['text_normalized'] = text_normalized - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TableRowHeaderTextsNormalized object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, - 'text_normalized') and self.text_normalized is not None: - _dict['text_normalized'] = self.text_normalized - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TableRowHeaderTextsNormalized object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TableRowHeaderTextsNormalized') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TableRowHeaderTextsNormalized') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class TableRowHeaders: """ Row-level cells, each applicable as a header to other cells in the same row as itself, @@ -12397,9 +11987,7 @@ class TableRowHeaders: `begin` and `end`. :param str text: (optional) The textual contents of this cell from the input document without associated markup content. - :param str text_normalized: (optional) If you provide customization input, the - normalized version of the cell text according to the customization; otherwise, - the same value as `text`. + :param str text_normalized: (optional) Normalized row header text. :param int row_index_begin: (optional) The `begin` index of this cell's `row` location in the current table. :param int row_index_end: (optional) The `end` index of this cell's `row` @@ -12432,9 +12020,7 @@ def __init__( labeled `begin` and `end`. :param str text: (optional) The textual contents of this cell from the input document without associated markup content. - :param str text_normalized: (optional) If you provide customization input, - the normalized version of the cell text according to the customization; - otherwise, the same value as `text`. + :param str text_normalized: (optional) Normalized row header text. :param int row_index_begin: (optional) The `begin` index of this cell's `row` location in the current table. :param int row_index_end: (optional) The `end` index of this cell's `row` @@ -12608,7 +12194,9 @@ class TrainingExample: :param str document_id: The document ID associated with this training example. :param str collection_id: The collection ID associated with this training example. - :param int relevance: The relevance of the training example. + :param int relevance: The relevance score of the training example. Scores range + from `0` to `100`. Zero means not relevant. The higher the number, the more + relevant the example. :param datetime created: (optional) The date and time the example was created. :param datetime updated: (optional) The date and time the example was updated. """ @@ -12629,7 +12217,9 @@ def __init__( example. :param str collection_id: The collection ID associated with this training example. - :param int relevance: The relevance of the training example. + :param int relevance: The relevance score of the training example. Scores + range from `0` to `100`. Zero means not relevant. The higher the number, + the more relevant the example. """ self.document_id = document_id self.collection_id = collection_id @@ -12712,7 +12302,11 @@ class TrainingQuery: :param str natural_language_query: The natural text query that is used as the training query. :param str filter: (optional) The filter used on the collection before the - **natural_language_query** is applied. + **natural_language_query** is applied. Only specify a filter if the documents + that you consider to be most relevant are not included in the top 100 results + when you submit test queries. If you specify a filter during training, apply the + same filter to queries that are submitted at runtime for optimal ranking + results. :param datetime created: (optional) The date and time the query was created. :param datetime updated: (optional) The date and time the query was updated. :param List[TrainingExample] examples: Array of training examples. @@ -12735,7 +12329,11 @@ def __init__( the training query. :param List[TrainingExample] examples: Array of training examples. :param str filter: (optional) The filter used on the collection before the - **natural_language_query** is applied. + **natural_language_query** is applied. Only specify a filter if the + documents that you consider to be most relevant are not included in the top + 100 results when you submit test queries. If you specify a filter during + training, apply the same filter to queries that are submitted at runtime + for optimal ranking results. """ self.query_id = query_id self.natural_language_query = natural_language_query diff --git a/test/unit/test_discovery_v2.py b/test/unit/test_discovery_v2.py index c8098805..3b1008aa 100644 --- a/test/unit/test_discovery_v2.py +++ b/test/unit/test_discovery_v2.py @@ -1861,7 +1861,7 @@ def test_query_all_params(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/query') - mock_response = '{"matching_results": 16, "results": [{"document_id": "document_id", "metadata": {"anyKey": "anyValue"}, "result_metadata": {"document_retrieval_source": "search", "collection_id": "collection_id", "confidence": 0}, "document_passages": [{"passage_text": "passage_text", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}], "aggregations": [{"type": "term", "field": "field", "count": 5, "name": "name", "results": [{"key": "key", "matching_results": 16, "relevancy": 9, "total_matching_documents": 24, "estimated_matching_results": 26, "aggregations": [{"anyKey": "anyValue"}]}]}], "retrieval_details": {"document_retrieval_strategy": "untrained"}, "suggested_query": "suggested_query", "suggested_refinements": [{"text": "text"}], "table_results": [{"table_id": "table_id", "source_document_id": "source_document_id", "collection_id": "collection_id", "table_html": "table_html", "table_html_offset": 17, "table": {"location": {"begin": 5, "end": 3}, "text": "text", "section_title": {"text": "text", "location": {"begin": 5, "end": 3}}, "title": {"text": "text", "location": {"begin": 5, "end": 3}}, "table_headers": [{"cell_id": "cell_id", "location": {"anyKey": "anyValue"}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "row_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "column_headers": [{"cell_id": "cell_id", "location": {"anyKey": "anyValue"}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "key_value_pairs": [{"key": {"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}, "value": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}]}], "body_cells": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16, "row_header_ids": [{"id": "id"}], "row_header_texts": [{"text": "text"}], "row_header_texts_normalized": [{"text_normalized": "text_normalized"}], "column_header_ids": [{"id": "id"}], "column_header_texts": [{"text": "text"}], "column_header_texts_normalized": [{"text_normalized": "text_normalized"}], "attributes": [{"type": "type", "text": "text", "location": {"begin": 5, "end": 3}}]}], "contexts": [{"text": "text", "location": {"begin": 5, "end": 3}}]}}], "passages": [{"passage_text": "passage_text", "passage_score": 13, "document_id": "document_id", "collection_id": "collection_id", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}' + mock_response = '{"matching_results": 16, "results": [{"document_id": "document_id", "metadata": {"anyKey": "anyValue"}, "result_metadata": {"document_retrieval_source": "search", "collection_id": "collection_id", "confidence": 0}, "document_passages": [{"passage_text": "passage_text", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}], "aggregations": [{"type": "term", "field": "field", "count": 5, "name": "name", "results": [{"key": "key", "matching_results": 16, "relevancy": 9, "total_matching_documents": 24, "estimated_matching_results": 26, "aggregations": [{"anyKey": "anyValue"}]}]}], "retrieval_details": {"document_retrieval_strategy": "untrained"}, "suggested_query": "suggested_query", "suggested_refinements": [{"text": "text"}], "table_results": [{"table_id": "table_id", "source_document_id": "source_document_id", "collection_id": "collection_id", "table_html": "table_html", "table_html_offset": 17, "table": {"location": {"begin": 5, "end": 3}, "text": "text", "section_title": {"text": "text", "location": {"begin": 5, "end": 3}}, "title": {"text": "text", "location": {"begin": 5, "end": 3}}, "table_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "row_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "column_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "key_value_pairs": [{"key": {"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}, "value": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}]}], "body_cells": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16, "row_header_ids": ["row_header_ids"], "row_header_texts": ["row_header_texts"], "row_header_texts_normalized": ["row_header_texts_normalized"], "column_header_ids": ["column_header_ids"], "column_header_texts": ["column_header_texts"], "column_header_texts_normalized": ["column_header_texts_normalized"], "attributes": [{"type": "type", "text": "text", "location": {"begin": 5, "end": 3}}]}], "contexts": [{"text": "text", "location": {"begin": 5, "end": 3}}]}}], "passages": [{"passage_text": "passage_text", "passage_score": 13, "document_id": "document_id", "collection_id": "collection_id", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}' responses.add( responses.POST, url, @@ -1973,7 +1973,7 @@ def test_query_required_params(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/query') - mock_response = '{"matching_results": 16, "results": [{"document_id": "document_id", "metadata": {"anyKey": "anyValue"}, "result_metadata": {"document_retrieval_source": "search", "collection_id": "collection_id", "confidence": 0}, "document_passages": [{"passage_text": "passage_text", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}], "aggregations": [{"type": "term", "field": "field", "count": 5, "name": "name", "results": [{"key": "key", "matching_results": 16, "relevancy": 9, "total_matching_documents": 24, "estimated_matching_results": 26, "aggregations": [{"anyKey": "anyValue"}]}]}], "retrieval_details": {"document_retrieval_strategy": "untrained"}, "suggested_query": "suggested_query", "suggested_refinements": [{"text": "text"}], "table_results": [{"table_id": "table_id", "source_document_id": "source_document_id", "collection_id": "collection_id", "table_html": "table_html", "table_html_offset": 17, "table": {"location": {"begin": 5, "end": 3}, "text": "text", "section_title": {"text": "text", "location": {"begin": 5, "end": 3}}, "title": {"text": "text", "location": {"begin": 5, "end": 3}}, "table_headers": [{"cell_id": "cell_id", "location": {"anyKey": "anyValue"}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "row_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "column_headers": [{"cell_id": "cell_id", "location": {"anyKey": "anyValue"}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "key_value_pairs": [{"key": {"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}, "value": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}]}], "body_cells": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16, "row_header_ids": [{"id": "id"}], "row_header_texts": [{"text": "text"}], "row_header_texts_normalized": [{"text_normalized": "text_normalized"}], "column_header_ids": [{"id": "id"}], "column_header_texts": [{"text": "text"}], "column_header_texts_normalized": [{"text_normalized": "text_normalized"}], "attributes": [{"type": "type", "text": "text", "location": {"begin": 5, "end": 3}}]}], "contexts": [{"text": "text", "location": {"begin": 5, "end": 3}}]}}], "passages": [{"passage_text": "passage_text", "passage_score": 13, "document_id": "document_id", "collection_id": "collection_id", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}' + mock_response = '{"matching_results": 16, "results": [{"document_id": "document_id", "metadata": {"anyKey": "anyValue"}, "result_metadata": {"document_retrieval_source": "search", "collection_id": "collection_id", "confidence": 0}, "document_passages": [{"passage_text": "passage_text", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}], "aggregations": [{"type": "term", "field": "field", "count": 5, "name": "name", "results": [{"key": "key", "matching_results": 16, "relevancy": 9, "total_matching_documents": 24, "estimated_matching_results": 26, "aggregations": [{"anyKey": "anyValue"}]}]}], "retrieval_details": {"document_retrieval_strategy": "untrained"}, "suggested_query": "suggested_query", "suggested_refinements": [{"text": "text"}], "table_results": [{"table_id": "table_id", "source_document_id": "source_document_id", "collection_id": "collection_id", "table_html": "table_html", "table_html_offset": 17, "table": {"location": {"begin": 5, "end": 3}, "text": "text", "section_title": {"text": "text", "location": {"begin": 5, "end": 3}}, "title": {"text": "text", "location": {"begin": 5, "end": 3}}, "table_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "row_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "column_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "key_value_pairs": [{"key": {"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}, "value": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}]}], "body_cells": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16, "row_header_ids": ["row_header_ids"], "row_header_texts": ["row_header_texts"], "row_header_texts_normalized": ["row_header_texts_normalized"], "column_header_ids": ["column_header_ids"], "column_header_texts": ["column_header_texts"], "column_header_texts_normalized": ["column_header_texts_normalized"], "attributes": [{"type": "type", "text": "text", "location": {"begin": 5, "end": 3}}]}], "contexts": [{"text": "text", "location": {"begin": 5, "end": 3}}]}}], "passages": [{"passage_text": "passage_text", "passage_score": 13, "document_id": "document_id", "collection_id": "collection_id", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}' responses.add( responses.POST, url, @@ -2011,7 +2011,7 @@ def test_query_value_error(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/query') - mock_response = '{"matching_results": 16, "results": [{"document_id": "document_id", "metadata": {"anyKey": "anyValue"}, "result_metadata": {"document_retrieval_source": "search", "collection_id": "collection_id", "confidence": 0}, "document_passages": [{"passage_text": "passage_text", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}], "aggregations": [{"type": "term", "field": "field", "count": 5, "name": "name", "results": [{"key": "key", "matching_results": 16, "relevancy": 9, "total_matching_documents": 24, "estimated_matching_results": 26, "aggregations": [{"anyKey": "anyValue"}]}]}], "retrieval_details": {"document_retrieval_strategy": "untrained"}, "suggested_query": "suggested_query", "suggested_refinements": [{"text": "text"}], "table_results": [{"table_id": "table_id", "source_document_id": "source_document_id", "collection_id": "collection_id", "table_html": "table_html", "table_html_offset": 17, "table": {"location": {"begin": 5, "end": 3}, "text": "text", "section_title": {"text": "text", "location": {"begin": 5, "end": 3}}, "title": {"text": "text", "location": {"begin": 5, "end": 3}}, "table_headers": [{"cell_id": "cell_id", "location": {"anyKey": "anyValue"}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "row_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "column_headers": [{"cell_id": "cell_id", "location": {"anyKey": "anyValue"}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "key_value_pairs": [{"key": {"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}, "value": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}]}], "body_cells": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16, "row_header_ids": [{"id": "id"}], "row_header_texts": [{"text": "text"}], "row_header_texts_normalized": [{"text_normalized": "text_normalized"}], "column_header_ids": [{"id": "id"}], "column_header_texts": [{"text": "text"}], "column_header_texts_normalized": [{"text_normalized": "text_normalized"}], "attributes": [{"type": "type", "text": "text", "location": {"begin": 5, "end": 3}}]}], "contexts": [{"text": "text", "location": {"begin": 5, "end": 3}}]}}], "passages": [{"passage_text": "passage_text", "passage_score": 13, "document_id": "document_id", "collection_id": "collection_id", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}' + mock_response = '{"matching_results": 16, "results": [{"document_id": "document_id", "metadata": {"anyKey": "anyValue"}, "result_metadata": {"document_retrieval_source": "search", "collection_id": "collection_id", "confidence": 0}, "document_passages": [{"passage_text": "passage_text", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}], "aggregations": [{"type": "term", "field": "field", "count": 5, "name": "name", "results": [{"key": "key", "matching_results": 16, "relevancy": 9, "total_matching_documents": 24, "estimated_matching_results": 26, "aggregations": [{"anyKey": "anyValue"}]}]}], "retrieval_details": {"document_retrieval_strategy": "untrained"}, "suggested_query": "suggested_query", "suggested_refinements": [{"text": "text"}], "table_results": [{"table_id": "table_id", "source_document_id": "source_document_id", "collection_id": "collection_id", "table_html": "table_html", "table_html_offset": 17, "table": {"location": {"begin": 5, "end": 3}, "text": "text", "section_title": {"text": "text", "location": {"begin": 5, "end": 3}}, "title": {"text": "text", "location": {"begin": 5, "end": 3}}, "table_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "row_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "column_headers": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "text_normalized": "text_normalized", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16}], "key_value_pairs": [{"key": {"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}, "value": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text"}]}], "body_cells": [{"cell_id": "cell_id", "location": {"begin": 5, "end": 3}, "text": "text", "row_index_begin": 15, "row_index_end": 13, "column_index_begin": 18, "column_index_end": 16, "row_header_ids": ["row_header_ids"], "row_header_texts": ["row_header_texts"], "row_header_texts_normalized": ["row_header_texts_normalized"], "column_header_ids": ["column_header_ids"], "column_header_texts": ["column_header_texts"], "column_header_texts_normalized": ["column_header_texts_normalized"], "attributes": [{"type": "type", "text": "text", "location": {"begin": 5, "end": 3}}]}], "contexts": [{"text": "text", "location": {"begin": 5, "end": 3}}]}}], "passages": [{"passage_text": "passage_text", "passage_score": 13, "document_id": "document_id", "collection_id": "collection_id", "start_offset": 12, "end_offset": 10, "field": "field", "answers": [{"answer_text": "answer_text", "start_offset": 12, "end_offset": 10, "confidence": 0}]}]}' responses.add( responses.POST, url, @@ -3703,7 +3703,7 @@ def test_list_enrichments_all_params(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/enrichments') - mock_response = '{"enrichments": [{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0}}]}' + mock_response = '{"enrichments": [{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0, "url": "url", "version": "2023-03-31", "secret": "secret", "headers": {"name": "name", "value": "value"}, "location_encoding": "`utf-16`"}}]}' responses.add( responses.GET, url, @@ -3741,7 +3741,7 @@ def test_list_enrichments_value_error(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/enrichments') - mock_response = '{"enrichments": [{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0}}]}' + mock_response = '{"enrichments": [{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0, "url": "url", "version": "2023-03-31", "secret": "secret", "headers": {"name": "name", "value": "value"}, "location_encoding": "`utf-16`"}}]}' responses.add( responses.GET, url, @@ -3784,7 +3784,7 @@ def test_create_enrichment_all_params(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/enrichments') - mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0}}' + mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0, "url": "url", "version": "2023-03-31", "secret": "secret", "headers": {"name": "name", "value": "value"}, "location_encoding": "`utf-16`"}}' responses.add( responses.POST, url, @@ -3793,6 +3793,11 @@ def test_create_enrichment_all_params(self): status=201, ) + # Construct a dict representation of a WebhookHeader model + webhook_header_model = {} + webhook_header_model['name'] = 'testString' + webhook_header_model['value'] = 'testString' + # Construct a dict representation of a EnrichmentOptions model enrichment_options_model = {} enrichment_options_model['languages'] = ['testString'] @@ -3803,6 +3808,11 @@ def test_create_enrichment_all_params(self): enrichment_options_model['model_id'] = 'testString' enrichment_options_model['confidence_threshold'] = 0 enrichment_options_model['top_k'] = 0 + enrichment_options_model['url'] = 'testString' + enrichment_options_model['version'] = '2023-03-31' + enrichment_options_model['secret'] = 'testString' + enrichment_options_model['headers'] = webhook_header_model + enrichment_options_model['location_encoding'] = '`utf-16`' # Construct a dict representation of a CreateEnrichment model create_enrichment_model = {} @@ -3844,7 +3854,7 @@ def test_create_enrichment_required_params(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/enrichments') - mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0}}' + mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0, "url": "url", "version": "2023-03-31", "secret": "secret", "headers": {"name": "name", "value": "value"}, "location_encoding": "`utf-16`"}}' responses.add( responses.POST, url, @@ -3853,6 +3863,11 @@ def test_create_enrichment_required_params(self): status=201, ) + # Construct a dict representation of a WebhookHeader model + webhook_header_model = {} + webhook_header_model['name'] = 'testString' + webhook_header_model['value'] = 'testString' + # Construct a dict representation of a EnrichmentOptions model enrichment_options_model = {} enrichment_options_model['languages'] = ['testString'] @@ -3863,6 +3878,11 @@ def test_create_enrichment_required_params(self): enrichment_options_model['model_id'] = 'testString' enrichment_options_model['confidence_threshold'] = 0 enrichment_options_model['top_k'] = 0 + enrichment_options_model['url'] = 'testString' + enrichment_options_model['version'] = '2023-03-31' + enrichment_options_model['secret'] = 'testString' + enrichment_options_model['headers'] = webhook_header_model + enrichment_options_model['location_encoding'] = '`utf-16`' # Construct a dict representation of a CreateEnrichment model create_enrichment_model = {} @@ -3902,7 +3922,7 @@ def test_create_enrichment_value_error(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/enrichments') - mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0}}' + mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0, "url": "url", "version": "2023-03-31", "secret": "secret", "headers": {"name": "name", "value": "value"}, "location_encoding": "`utf-16`"}}' responses.add( responses.POST, url, @@ -3911,6 +3931,11 @@ def test_create_enrichment_value_error(self): status=201, ) + # Construct a dict representation of a WebhookHeader model + webhook_header_model = {} + webhook_header_model['name'] = 'testString' + webhook_header_model['value'] = 'testString' + # Construct a dict representation of a EnrichmentOptions model enrichment_options_model = {} enrichment_options_model['languages'] = ['testString'] @@ -3921,6 +3946,11 @@ def test_create_enrichment_value_error(self): enrichment_options_model['model_id'] = 'testString' enrichment_options_model['confidence_threshold'] = 0 enrichment_options_model['top_k'] = 0 + enrichment_options_model['url'] = 'testString' + enrichment_options_model['version'] = '2023-03-31' + enrichment_options_model['secret'] = 'testString' + enrichment_options_model['headers'] = webhook_header_model + enrichment_options_model['location_encoding'] = '`utf-16`' # Construct a dict representation of a CreateEnrichment model create_enrichment_model = {} @@ -3965,7 +3995,7 @@ def test_get_enrichment_all_params(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/enrichments/testString') - mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0}}' + mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0, "url": "url", "version": "2023-03-31", "secret": "secret", "headers": {"name": "name", "value": "value"}, "location_encoding": "`utf-16`"}}' responses.add( responses.GET, url, @@ -4005,7 +4035,7 @@ def test_get_enrichment_value_error(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/enrichments/testString') - mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0}}' + mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0, "url": "url", "version": "2023-03-31", "secret": "secret", "headers": {"name": "name", "value": "value"}, "location_encoding": "`utf-16`"}}' responses.add( responses.GET, url, @@ -4050,7 +4080,7 @@ def test_update_enrichment_all_params(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/enrichments/testString') - mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0}}' + mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0, "url": "url", "version": "2023-03-31", "secret": "secret", "headers": {"name": "name", "value": "value"}, "location_encoding": "`utf-16`"}}' responses.add( responses.POST, url, @@ -4098,7 +4128,7 @@ def test_update_enrichment_value_error(self): """ # Set up mock url = preprocess_url('/v2/projects/testString/enrichments/testString') - mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0}}' + mock_response = '{"enrichment_id": "enrichment_id", "name": "name", "description": "description", "type": "part_of_speech", "options": {"languages": ["languages"], "entity_type": "entity_type", "regular_expression": "regular_expression", "result_field": "result_field", "classifier_id": "classifier_id", "model_id": "model_id", "confidence_threshold": 0, "top_k": 0, "url": "url", "version": "2023-03-31", "secret": "secret", "headers": {"name": "name", "value": "value"}, "location_encoding": "`utf-16`"}}' responses.add( responses.POST, url, @@ -6099,6 +6129,10 @@ def test_create_enrichment_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + webhook_header_model = {} # WebhookHeader + webhook_header_model['name'] = 'testString' + webhook_header_model['value'] = 'testString' + enrichment_options_model = {} # EnrichmentOptions enrichment_options_model['languages'] = ['testString'] enrichment_options_model['entity_type'] = 'testString' @@ -6108,6 +6142,11 @@ def test_create_enrichment_serialization(self): enrichment_options_model['model_id'] = 'testString' enrichment_options_model['confidence_threshold'] = 0 enrichment_options_model['top_k'] = 0 + enrichment_options_model['url'] = 'testString' + enrichment_options_model['version'] = '2023-03-31' + enrichment_options_model['secret'] = 'testString' + enrichment_options_model['headers'] = webhook_header_model + enrichment_options_model['location_encoding'] = '`utf-16`' # Construct a json representation of a CreateEnrichment model create_enrichment_model_json = {} @@ -6723,6 +6762,10 @@ def test_enrichment_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + webhook_header_model = {} # WebhookHeader + webhook_header_model['name'] = 'testString' + webhook_header_model['value'] = 'testString' + enrichment_options_model = {} # EnrichmentOptions enrichment_options_model['languages'] = ['testString'] enrichment_options_model['entity_type'] = 'testString' @@ -6732,6 +6775,11 @@ def test_enrichment_serialization(self): enrichment_options_model['model_id'] = 'testString' enrichment_options_model['confidence_threshold'] = 0 enrichment_options_model['top_k'] = 0 + enrichment_options_model['url'] = 'testString' + enrichment_options_model['version'] = '2023-03-31' + enrichment_options_model['secret'] = 'testString' + enrichment_options_model['headers'] = webhook_header_model + enrichment_options_model['location_encoding'] = '`utf-16`' # Construct a json representation of a Enrichment model enrichment_model_json = {} @@ -6766,6 +6814,12 @@ def test_enrichment_options_serialization(self): Test serialization/deserialization for EnrichmentOptions """ + # Construct dict forms of any model objects needed in order to build this model. + + webhook_header_model = {} # WebhookHeader + webhook_header_model['name'] = 'testString' + webhook_header_model['value'] = 'testString' + # Construct a json representation of a EnrichmentOptions model enrichment_options_model_json = {} enrichment_options_model_json['languages'] = ['testString'] @@ -6776,6 +6830,11 @@ def test_enrichment_options_serialization(self): enrichment_options_model_json['model_id'] = 'testString' enrichment_options_model_json['confidence_threshold'] = 0 enrichment_options_model_json['top_k'] = 0 + enrichment_options_model_json['url'] = 'testString' + enrichment_options_model_json['version'] = '2023-03-31' + enrichment_options_model_json['secret'] = 'testString' + enrichment_options_model_json['headers'] = webhook_header_model + enrichment_options_model_json['location_encoding'] = '`utf-16`' # Construct a model instance of EnrichmentOptions by calling from_dict on the json representation enrichment_options_model = EnrichmentOptions.from_dict(enrichment_options_model_json) @@ -6805,6 +6864,10 @@ def test_enrichments_serialization(self): # Construct dict forms of any model objects needed in order to build this model. + webhook_header_model = {} # WebhookHeader + webhook_header_model['name'] = 'testString' + webhook_header_model['value'] = 'testString' + enrichment_options_model = {} # EnrichmentOptions enrichment_options_model['languages'] = ['testString'] enrichment_options_model['entity_type'] = 'testString' @@ -6814,6 +6877,11 @@ def test_enrichments_serialization(self): enrichment_options_model['model_id'] = 'testString' enrichment_options_model['confidence_threshold'] = 0 enrichment_options_model['top_k'] = 0 + enrichment_options_model['url'] = 'testString' + enrichment_options_model['version'] = '2023-03-31' + enrichment_options_model['secret'] = 'testString' + enrichment_options_model['headers'] = webhook_header_model + enrichment_options_model['location_encoding'] = '`utf-16`' enrichment_model = {} # Enrichment enrichment_model['name'] = 'testString' @@ -7678,7 +7746,7 @@ def test_query_response_serialization(self): table_headers_model = {} # TableHeaders table_headers_model['cell_id'] = 'testString' - table_headers_model['location'] = {'anyKey': 'anyValue'} + table_headers_model['location'] = table_element_location_model table_headers_model['text'] = 'testString' table_headers_model['row_index_begin'] = 26 table_headers_model['row_index_end'] = 26 @@ -7697,7 +7765,7 @@ def test_query_response_serialization(self): table_column_headers_model = {} # TableColumnHeaders table_column_headers_model['cell_id'] = 'testString' - table_column_headers_model['location'] = {'anyKey': 'anyValue'} + table_column_headers_model['location'] = table_element_location_model table_column_headers_model['text'] = 'testString' table_column_headers_model['text_normalized'] = 'testString' table_column_headers_model['row_index_begin'] = 26 @@ -7719,24 +7787,6 @@ def test_query_response_serialization(self): table_key_value_pairs_model['key'] = table_cell_key_model table_key_value_pairs_model['value'] = [table_cell_values_model] - table_row_header_ids_model = {} # TableRowHeaderIds - table_row_header_ids_model['id'] = 'testString' - - table_row_header_texts_model = {} # TableRowHeaderTexts - table_row_header_texts_model['text'] = 'testString' - - table_row_header_texts_normalized_model = {} # TableRowHeaderTextsNormalized - table_row_header_texts_normalized_model['text_normalized'] = 'testString' - - table_column_header_ids_model = {} # TableColumnHeaderIds - table_column_header_ids_model['id'] = 'testString' - - table_column_header_texts_model = {} # TableColumnHeaderTexts - table_column_header_texts_model['text'] = 'testString' - - table_column_header_texts_normalized_model = {} # TableColumnHeaderTextsNormalized - table_column_header_texts_normalized_model['text_normalized'] = 'testString' - document_attribute_model = {} # DocumentAttribute document_attribute_model['type'] = 'testString' document_attribute_model['text'] = 'testString' @@ -7750,12 +7800,12 @@ def test_query_response_serialization(self): table_body_cells_model['row_index_end'] = 26 table_body_cells_model['column_index_begin'] = 26 table_body_cells_model['column_index_end'] = 26 - table_body_cells_model['row_header_ids'] = [table_row_header_ids_model] - table_body_cells_model['row_header_texts'] = [table_row_header_texts_model] - table_body_cells_model['row_header_texts_normalized'] = [table_row_header_texts_normalized_model] - table_body_cells_model['column_header_ids'] = [table_column_header_ids_model] - table_body_cells_model['column_header_texts'] = [table_column_header_texts_model] - table_body_cells_model['column_header_texts_normalized'] = [table_column_header_texts_normalized_model] + table_body_cells_model['row_header_ids'] = ['testString'] + table_body_cells_model['row_header_texts'] = ['testString'] + table_body_cells_model['row_header_texts_normalized'] = ['testString'] + table_body_cells_model['column_header_ids'] = ['testString'] + table_body_cells_model['column_header_texts'] = ['testString'] + table_body_cells_model['column_header_texts_normalized'] = ['testString'] table_body_cells_model['attributes'] = [document_attribute_model] table_result_table_model = {} # TableResultTable @@ -8050,7 +8100,7 @@ def test_query_table_result_serialization(self): table_headers_model = {} # TableHeaders table_headers_model['cell_id'] = 'testString' - table_headers_model['location'] = {'anyKey': 'anyValue'} + table_headers_model['location'] = table_element_location_model table_headers_model['text'] = 'testString' table_headers_model['row_index_begin'] = 26 table_headers_model['row_index_end'] = 26 @@ -8069,7 +8119,7 @@ def test_query_table_result_serialization(self): table_column_headers_model = {} # TableColumnHeaders table_column_headers_model['cell_id'] = 'testString' - table_column_headers_model['location'] = {'anyKey': 'anyValue'} + table_column_headers_model['location'] = table_element_location_model table_column_headers_model['text'] = 'testString' table_column_headers_model['text_normalized'] = 'testString' table_column_headers_model['row_index_begin'] = 26 @@ -8091,24 +8141,6 @@ def test_query_table_result_serialization(self): table_key_value_pairs_model['key'] = table_cell_key_model table_key_value_pairs_model['value'] = [table_cell_values_model] - table_row_header_ids_model = {} # TableRowHeaderIds - table_row_header_ids_model['id'] = 'testString' - - table_row_header_texts_model = {} # TableRowHeaderTexts - table_row_header_texts_model['text'] = 'testString' - - table_row_header_texts_normalized_model = {} # TableRowHeaderTextsNormalized - table_row_header_texts_normalized_model['text_normalized'] = 'testString' - - table_column_header_ids_model = {} # TableColumnHeaderIds - table_column_header_ids_model['id'] = 'testString' - - table_column_header_texts_model = {} # TableColumnHeaderTexts - table_column_header_texts_model['text'] = 'testString' - - table_column_header_texts_normalized_model = {} # TableColumnHeaderTextsNormalized - table_column_header_texts_normalized_model['text_normalized'] = 'testString' - document_attribute_model = {} # DocumentAttribute document_attribute_model['type'] = 'testString' document_attribute_model['text'] = 'testString' @@ -8122,12 +8154,12 @@ def test_query_table_result_serialization(self): table_body_cells_model['row_index_end'] = 26 table_body_cells_model['column_index_begin'] = 26 table_body_cells_model['column_index_end'] = 26 - table_body_cells_model['row_header_ids'] = [table_row_header_ids_model] - table_body_cells_model['row_header_texts'] = [table_row_header_texts_model] - table_body_cells_model['row_header_texts_normalized'] = [table_row_header_texts_normalized_model] - table_body_cells_model['column_header_ids'] = [table_column_header_ids_model] - table_body_cells_model['column_header_texts'] = [table_column_header_texts_model] - table_body_cells_model['column_header_texts_normalized'] = [table_column_header_texts_normalized_model] + table_body_cells_model['row_header_ids'] = ['testString'] + table_body_cells_model['row_header_texts'] = ['testString'] + table_body_cells_model['row_header_texts_normalized'] = ['testString'] + table_body_cells_model['column_header_ids'] = ['testString'] + table_body_cells_model['column_header_texts'] = ['testString'] + table_body_cells_model['column_header_texts_normalized'] = ['testString'] table_body_cells_model['attributes'] = [document_attribute_model] table_result_table_model = {} # TableResultTable @@ -8435,24 +8467,6 @@ def test_table_body_cells_serialization(self): table_element_location_model['begin'] = 26 table_element_location_model['end'] = 26 - table_row_header_ids_model = {} # TableRowHeaderIds - table_row_header_ids_model['id'] = 'testString' - - table_row_header_texts_model = {} # TableRowHeaderTexts - table_row_header_texts_model['text'] = 'testString' - - table_row_header_texts_normalized_model = {} # TableRowHeaderTextsNormalized - table_row_header_texts_normalized_model['text_normalized'] = 'testString' - - table_column_header_ids_model = {} # TableColumnHeaderIds - table_column_header_ids_model['id'] = 'testString' - - table_column_header_texts_model = {} # TableColumnHeaderTexts - table_column_header_texts_model['text'] = 'testString' - - table_column_header_texts_normalized_model = {} # TableColumnHeaderTextsNormalized - table_column_header_texts_normalized_model['text_normalized'] = 'testString' - document_attribute_model = {} # DocumentAttribute document_attribute_model['type'] = 'testString' document_attribute_model['text'] = 'testString' @@ -8467,12 +8481,12 @@ def test_table_body_cells_serialization(self): table_body_cells_model_json['row_index_end'] = 26 table_body_cells_model_json['column_index_begin'] = 26 table_body_cells_model_json['column_index_end'] = 26 - table_body_cells_model_json['row_header_ids'] = [table_row_header_ids_model] - table_body_cells_model_json['row_header_texts'] = [table_row_header_texts_model] - table_body_cells_model_json['row_header_texts_normalized'] = [table_row_header_texts_normalized_model] - table_body_cells_model_json['column_header_ids'] = [table_column_header_ids_model] - table_body_cells_model_json['column_header_texts'] = [table_column_header_texts_model] - table_body_cells_model_json['column_header_texts_normalized'] = [table_column_header_texts_normalized_model] + table_body_cells_model_json['row_header_ids'] = ['testString'] + table_body_cells_model_json['row_header_texts'] = ['testString'] + table_body_cells_model_json['row_header_texts_normalized'] = ['testString'] + table_body_cells_model_json['column_header_ids'] = ['testString'] + table_body_cells_model_json['column_header_texts'] = ['testString'] + table_body_cells_model_json['column_header_texts_normalized'] = ['testString'] table_body_cells_model_json['attributes'] = [document_attribute_model] # Construct a model instance of TableBodyCells by calling from_dict on the json representation @@ -8567,96 +8581,6 @@ def test_table_cell_values_serialization(self): assert table_cell_values_model_json2 == table_cell_values_model_json -class TestModel_TableColumnHeaderIds: - """ - Test Class for TableColumnHeaderIds - """ - - def test_table_column_header_ids_serialization(self): - """ - Test serialization/deserialization for TableColumnHeaderIds - """ - - # Construct a json representation of a TableColumnHeaderIds model - table_column_header_ids_model_json = {} - table_column_header_ids_model_json['id'] = 'testString' - - # Construct a model instance of TableColumnHeaderIds by calling from_dict on the json representation - table_column_header_ids_model = TableColumnHeaderIds.from_dict(table_column_header_ids_model_json) - assert table_column_header_ids_model != False - - # Construct a model instance of TableColumnHeaderIds by calling from_dict on the json representation - table_column_header_ids_model_dict = TableColumnHeaderIds.from_dict(table_column_header_ids_model_json).__dict__ - table_column_header_ids_model2 = TableColumnHeaderIds(**table_column_header_ids_model_dict) - - # Verify the model instances are equivalent - assert table_column_header_ids_model == table_column_header_ids_model2 - - # Convert model instance back to dict and verify no loss of data - table_column_header_ids_model_json2 = table_column_header_ids_model.to_dict() - assert table_column_header_ids_model_json2 == table_column_header_ids_model_json - - -class TestModel_TableColumnHeaderTexts: - """ - Test Class for TableColumnHeaderTexts - """ - - def test_table_column_header_texts_serialization(self): - """ - Test serialization/deserialization for TableColumnHeaderTexts - """ - - # Construct a json representation of a TableColumnHeaderTexts model - table_column_header_texts_model_json = {} - table_column_header_texts_model_json['text'] = 'testString' - - # Construct a model instance of TableColumnHeaderTexts by calling from_dict on the json representation - table_column_header_texts_model = TableColumnHeaderTexts.from_dict(table_column_header_texts_model_json) - assert table_column_header_texts_model != False - - # Construct a model instance of TableColumnHeaderTexts by calling from_dict on the json representation - table_column_header_texts_model_dict = TableColumnHeaderTexts.from_dict(table_column_header_texts_model_json).__dict__ - table_column_header_texts_model2 = TableColumnHeaderTexts(**table_column_header_texts_model_dict) - - # Verify the model instances are equivalent - assert table_column_header_texts_model == table_column_header_texts_model2 - - # Convert model instance back to dict and verify no loss of data - table_column_header_texts_model_json2 = table_column_header_texts_model.to_dict() - assert table_column_header_texts_model_json2 == table_column_header_texts_model_json - - -class TestModel_TableColumnHeaderTextsNormalized: - """ - Test Class for TableColumnHeaderTextsNormalized - """ - - def test_table_column_header_texts_normalized_serialization(self): - """ - Test serialization/deserialization for TableColumnHeaderTextsNormalized - """ - - # Construct a json representation of a TableColumnHeaderTextsNormalized model - table_column_header_texts_normalized_model_json = {} - table_column_header_texts_normalized_model_json['text_normalized'] = 'testString' - - # Construct a model instance of TableColumnHeaderTextsNormalized by calling from_dict on the json representation - table_column_header_texts_normalized_model = TableColumnHeaderTextsNormalized.from_dict(table_column_header_texts_normalized_model_json) - assert table_column_header_texts_normalized_model != False - - # Construct a model instance of TableColumnHeaderTextsNormalized by calling from_dict on the json representation - table_column_header_texts_normalized_model_dict = TableColumnHeaderTextsNormalized.from_dict(table_column_header_texts_normalized_model_json).__dict__ - table_column_header_texts_normalized_model2 = TableColumnHeaderTextsNormalized(**table_column_header_texts_normalized_model_dict) - - # Verify the model instances are equivalent - assert table_column_header_texts_normalized_model == table_column_header_texts_normalized_model2 - - # Convert model instance back to dict and verify no loss of data - table_column_header_texts_normalized_model_json2 = table_column_header_texts_normalized_model.to_dict() - assert table_column_header_texts_normalized_model_json2 == table_column_header_texts_normalized_model_json - - class TestModel_TableColumnHeaders: """ Test Class for TableColumnHeaders @@ -8667,10 +8591,16 @@ def test_table_column_headers_serialization(self): Test serialization/deserialization for TableColumnHeaders """ + # Construct dict forms of any model objects needed in order to build this model. + + table_element_location_model = {} # TableElementLocation + table_element_location_model['begin'] = 26 + table_element_location_model['end'] = 26 + # Construct a json representation of a TableColumnHeaders model table_column_headers_model_json = {} table_column_headers_model_json['cell_id'] = 'testString' - table_column_headers_model_json['location'] = {'anyKey': 'anyValue'} + table_column_headers_model_json['location'] = table_element_location_model table_column_headers_model_json['text'] = 'testString' table_column_headers_model_json['text_normalized'] = 'testString' table_column_headers_model_json['row_index_begin'] = 26 @@ -8735,10 +8665,16 @@ def test_table_headers_serialization(self): Test serialization/deserialization for TableHeaders """ + # Construct dict forms of any model objects needed in order to build this model. + + table_element_location_model = {} # TableElementLocation + table_element_location_model['begin'] = 26 + table_element_location_model['end'] = 26 + # Construct a json representation of a TableHeaders model table_headers_model_json = {} table_headers_model_json['cell_id'] = 'testString' - table_headers_model_json['location'] = {'anyKey': 'anyValue'} + table_headers_model_json['location'] = table_element_location_model table_headers_model_json['text'] = 'testString' table_headers_model_json['row_index_begin'] = 26 table_headers_model_json['row_index_end'] = 26 @@ -8830,7 +8766,7 @@ def test_table_result_table_serialization(self): table_headers_model = {} # TableHeaders table_headers_model['cell_id'] = 'testString' - table_headers_model['location'] = {'anyKey': 'anyValue'} + table_headers_model['location'] = table_element_location_model table_headers_model['text'] = 'testString' table_headers_model['row_index_begin'] = 26 table_headers_model['row_index_end'] = 26 @@ -8849,7 +8785,7 @@ def test_table_result_table_serialization(self): table_column_headers_model = {} # TableColumnHeaders table_column_headers_model['cell_id'] = 'testString' - table_column_headers_model['location'] = {'anyKey': 'anyValue'} + table_column_headers_model['location'] = table_element_location_model table_column_headers_model['text'] = 'testString' table_column_headers_model['text_normalized'] = 'testString' table_column_headers_model['row_index_begin'] = 26 @@ -8871,24 +8807,6 @@ def test_table_result_table_serialization(self): table_key_value_pairs_model['key'] = table_cell_key_model table_key_value_pairs_model['value'] = [table_cell_values_model] - table_row_header_ids_model = {} # TableRowHeaderIds - table_row_header_ids_model['id'] = 'testString' - - table_row_header_texts_model = {} # TableRowHeaderTexts - table_row_header_texts_model['text'] = 'testString' - - table_row_header_texts_normalized_model = {} # TableRowHeaderTextsNormalized - table_row_header_texts_normalized_model['text_normalized'] = 'testString' - - table_column_header_ids_model = {} # TableColumnHeaderIds - table_column_header_ids_model['id'] = 'testString' - - table_column_header_texts_model = {} # TableColumnHeaderTexts - table_column_header_texts_model['text'] = 'testString' - - table_column_header_texts_normalized_model = {} # TableColumnHeaderTextsNormalized - table_column_header_texts_normalized_model['text_normalized'] = 'testString' - document_attribute_model = {} # DocumentAttribute document_attribute_model['type'] = 'testString' document_attribute_model['text'] = 'testString' @@ -8902,12 +8820,12 @@ def test_table_result_table_serialization(self): table_body_cells_model['row_index_end'] = 26 table_body_cells_model['column_index_begin'] = 26 table_body_cells_model['column_index_end'] = 26 - table_body_cells_model['row_header_ids'] = [table_row_header_ids_model] - table_body_cells_model['row_header_texts'] = [table_row_header_texts_model] - table_body_cells_model['row_header_texts_normalized'] = [table_row_header_texts_normalized_model] - table_body_cells_model['column_header_ids'] = [table_column_header_ids_model] - table_body_cells_model['column_header_texts'] = [table_column_header_texts_model] - table_body_cells_model['column_header_texts_normalized'] = [table_column_header_texts_normalized_model] + table_body_cells_model['row_header_ids'] = ['testString'] + table_body_cells_model['row_header_texts'] = ['testString'] + table_body_cells_model['row_header_texts_normalized'] = ['testString'] + table_body_cells_model['column_header_ids'] = ['testString'] + table_body_cells_model['column_header_texts'] = ['testString'] + table_body_cells_model['column_header_texts_normalized'] = ['testString'] table_body_cells_model['attributes'] = [document_attribute_model] # Construct a json representation of a TableResultTable model @@ -8939,96 +8857,6 @@ def test_table_result_table_serialization(self): assert table_result_table_model_json2 == table_result_table_model_json -class TestModel_TableRowHeaderIds: - """ - Test Class for TableRowHeaderIds - """ - - def test_table_row_header_ids_serialization(self): - """ - Test serialization/deserialization for TableRowHeaderIds - """ - - # Construct a json representation of a TableRowHeaderIds model - table_row_header_ids_model_json = {} - table_row_header_ids_model_json['id'] = 'testString' - - # Construct a model instance of TableRowHeaderIds by calling from_dict on the json representation - table_row_header_ids_model = TableRowHeaderIds.from_dict(table_row_header_ids_model_json) - assert table_row_header_ids_model != False - - # Construct a model instance of TableRowHeaderIds by calling from_dict on the json representation - table_row_header_ids_model_dict = TableRowHeaderIds.from_dict(table_row_header_ids_model_json).__dict__ - table_row_header_ids_model2 = TableRowHeaderIds(**table_row_header_ids_model_dict) - - # Verify the model instances are equivalent - assert table_row_header_ids_model == table_row_header_ids_model2 - - # Convert model instance back to dict and verify no loss of data - table_row_header_ids_model_json2 = table_row_header_ids_model.to_dict() - assert table_row_header_ids_model_json2 == table_row_header_ids_model_json - - -class TestModel_TableRowHeaderTexts: - """ - Test Class for TableRowHeaderTexts - """ - - def test_table_row_header_texts_serialization(self): - """ - Test serialization/deserialization for TableRowHeaderTexts - """ - - # Construct a json representation of a TableRowHeaderTexts model - table_row_header_texts_model_json = {} - table_row_header_texts_model_json['text'] = 'testString' - - # Construct a model instance of TableRowHeaderTexts by calling from_dict on the json representation - table_row_header_texts_model = TableRowHeaderTexts.from_dict(table_row_header_texts_model_json) - assert table_row_header_texts_model != False - - # Construct a model instance of TableRowHeaderTexts by calling from_dict on the json representation - table_row_header_texts_model_dict = TableRowHeaderTexts.from_dict(table_row_header_texts_model_json).__dict__ - table_row_header_texts_model2 = TableRowHeaderTexts(**table_row_header_texts_model_dict) - - # Verify the model instances are equivalent - assert table_row_header_texts_model == table_row_header_texts_model2 - - # Convert model instance back to dict and verify no loss of data - table_row_header_texts_model_json2 = table_row_header_texts_model.to_dict() - assert table_row_header_texts_model_json2 == table_row_header_texts_model_json - - -class TestModel_TableRowHeaderTextsNormalized: - """ - Test Class for TableRowHeaderTextsNormalized - """ - - def test_table_row_header_texts_normalized_serialization(self): - """ - Test serialization/deserialization for TableRowHeaderTextsNormalized - """ - - # Construct a json representation of a TableRowHeaderTextsNormalized model - table_row_header_texts_normalized_model_json = {} - table_row_header_texts_normalized_model_json['text_normalized'] = 'testString' - - # Construct a model instance of TableRowHeaderTextsNormalized by calling from_dict on the json representation - table_row_header_texts_normalized_model = TableRowHeaderTextsNormalized.from_dict(table_row_header_texts_normalized_model_json) - assert table_row_header_texts_normalized_model != False - - # Construct a model instance of TableRowHeaderTextsNormalized by calling from_dict on the json representation - table_row_header_texts_normalized_model_dict = TableRowHeaderTextsNormalized.from_dict(table_row_header_texts_normalized_model_json).__dict__ - table_row_header_texts_normalized_model2 = TableRowHeaderTextsNormalized(**table_row_header_texts_normalized_model_dict) - - # Verify the model instances are equivalent - assert table_row_header_texts_normalized_model == table_row_header_texts_normalized_model2 - - # Convert model instance back to dict and verify no loss of data - table_row_header_texts_normalized_model_json2 = table_row_header_texts_normalized_model.to_dict() - assert table_row_header_texts_normalized_model_json2 == table_row_header_texts_normalized_model_json - - class TestModel_TableRowHeaders: """ Test Class for TableRowHeaders @@ -9253,6 +9081,37 @@ def test_update_document_classifier_serialization(self): assert update_document_classifier_model_json2 == update_document_classifier_model_json +class TestModel_WebhookHeader: + """ + Test Class for WebhookHeader + """ + + def test_webhook_header_serialization(self): + """ + Test serialization/deserialization for WebhookHeader + """ + + # Construct a json representation of a WebhookHeader model + webhook_header_model_json = {} + webhook_header_model_json['name'] = 'testString' + webhook_header_model_json['value'] = 'testString' + + # Construct a model instance of WebhookHeader by calling from_dict on the json representation + webhook_header_model = WebhookHeader.from_dict(webhook_header_model_json) + assert webhook_header_model != False + + # Construct a model instance of WebhookHeader by calling from_dict on the json representation + webhook_header_model_dict = WebhookHeader.from_dict(webhook_header_model_json).__dict__ + webhook_header_model2 = WebhookHeader(**webhook_header_model_dict) + + # Verify the model instances are equivalent + assert webhook_header_model == webhook_header_model2 + + # Convert model instance back to dict and verify no loss of data + webhook_header_model_json2 = webhook_header_model.to_dict() + assert webhook_header_model_json2 == webhook_header_model_json + + class TestModel_QueryAggregationQueryCalculationAggregation: """ Test Class for QueryAggregationQueryCalculationAggregation