EqualsAssertion

class aws_cdk.integ_tests_alpha.EqualsAssertion(scope, id, *, actual, expected, fail_deployment=None)

Bases: Construct

(experimental) Construct that creates a CustomResource to assert that two values are equal.

Stability:

experimental

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.integ_tests_alpha as integ_tests_alpha

# actual_result: integ_tests_alpha.ActualResult
# expected_result: integ_tests_alpha.ExpectedResult

equals_assertion = integ_tests_alpha.EqualsAssertion(self, "MyEqualsAssertion",
    actual=actual_result,
    expected=expected_result,

    # the properties below are optional
    fail_deployment=False
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • actual (ActualResult) – (experimental) The actual results to compare.

  • expected (ExpectedResult) – (experimental) The expected result to assert.

  • fail_deployment (Optional[bool]) – (experimental) Set this to true if a failed assertion should result in a CloudFormation deployment failure. This is only necessary if assertions are being executed outside of integ-runner. Default: false

Stability:

experimental

Methods

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

node

The tree node.

result

(experimental) The result of the assertion.

Stability:

experimental

Static Methods

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.