GlobalConstantsDefinition¶
- class GlobalConstantsDefinition¶
Returned by
-
AppendConstant(name, value=
None, description=None)¶ Appends a new global constant. If a constant with the same name already exists, it will be overwritten.
- Parameters:
- Raises:
ApiError – If constant with the given name and value could not be appended, e.g. if the name is no valid identifier, or the value can not be parsed.
- Clone()¶
Call this method if you want to use API-objects in multiple contexts, e.g. if you want to insert a specific test step in multiple blocks.
- Returns:
A copy of this object
- Return type:
- GetAllConstantNames()¶
Returns a list of all global constant names.
- Returns:
List of all global constant names
- Return type:
list[str]
- GetDescription(name)¶
Returns the description of the constant specified by the given name.
- Parameters:
- name : str¶
Name of the constant
- Returns:
Description text
- Return type:
str
- GetFilename()¶
Returns the file name of the global constants definition file, if this is a file. Returns None if this is part of the test configuration, a parameter set or an unsaved file.
- Returns:
The file name of the saved file or None, if not a file
- Return type:
str
- GetValue(name)¶
Returns the string representation of the value expression of the constant, specified by the given name.
- Parameters:
- name : str¶
Name of the constant
- Returns:
Expression for the constant value
- Return type:
str
- Raises:
ApiError – If the constant with the given name does not exist
- RemoveConstant(name)¶
Removes the global constant specified by the given name.
- Parameters:
- name : str¶
Name of the constant
- Returns:
True if successful. False if no constant with such name exists.
- Return type:
boolean
-
Save(filename=
'', allowCompatibilityFallback=False)¶ Saves the global constants definition to a file. Appends file ending if needed.
- Parameters:
- filename : str¶
File name for the global constants definition file (*.gcd); Either absolute or relative to the ‘Parameter’ directory. If left out, use the existing file name and path (previously set with
Save()or fromParameterApi.OpenGlobalConstantsDefinition())- allowCompatibilityFallback : bool¶
If True and a compatibility mode is active, save in the minimum compatible version when needed. If False, compatibility problems raise an exception instead.
- SetDescription(name, description)¶
Sets the description of the constant specified by the given name.