caosadvancedtools.tools package

Submodules

caosadvancedtools.tools.strip_null_from_list module

Remove null elements from list properties.

caosadvancedtools.tools.strip_null_from_list.main()

The main function of this script.

caosadvancedtools.tools.strip_null_from_list.strip(dry_run: bool = False, strip_empty_string: bool = False) None

Implementation of null element removal.

Parameters:
  • dry_run (bool, default=False) – If True, only print indicative output, do not remove anything

  • strip_empty_string (bool, default=False) – If True, also strip empty strings.

  • Limitations

  • -----------

  • reasons (For efficiency)

  • their (this function only looks for properties which are LIST<> valued in)

  • ``my_prop (Property definition. For example a) –

    LIST<TEXT>`` is covered. On the other hand:

  • if

  • ``other_prop

    DOUBLE``:

  • LIST<DOUBLE> (but a specific Entity uses other_prop as)

  • will (this)

  • found. (not be)

caosadvancedtools.tools.test module

Useful tools for unit or integration tests.

caosadvancedtools.tools.test.assert_equal_jsons(json1, json2, allow_none: bool = True, allow_empty: bool = True, ignore_datetime: bool = False, ignore_id_value: bool = False, allow_name_dict: bool = False, path: list | None = None) None

Compare two json objects for near equality.

Raise an assertion exception if they are not equal.

Parameters:

allow_name_dict (bool, default=False) – If True, a string and a dict {"name": "string's value"} are considered equal.

caosadvancedtools.tools.test.compare_workbooks(wb1: Workbook, wb2: Workbook, hidden: bool = True)

Compare two workbooks for equal content.

Raises an error if differences are found.

Parameters:

hidden (bool, optional) – Test if the “hidden” status of rows and columns is the same.

caosadvancedtools.tools.test.equals_with_casting(value1, value2, ignore_datetime: bool = False) bool

Compare two values, return True if equal, False otherwise. Try to cast to clever datatypes.

caosadvancedtools.tools.test.purge_from_json(data: dict | list, remove_keys: list[str]) dict | list

Remove matching entries from json data.

Parameters:
  • data (Union[dict, list]) – The json data to clean.

  • remove_keys (list[str]) – Remove all keys that are in this list

Returns:

out – The cleaned result.

Return type:

Union[dict, list]

Module contents