castlecraft_engineer.abstractions.specification
¶
castlecraft_engineer.abstractions.specification
¶
AndSpecification
¶
Bases: Specification[T]
A composite specification that is satisfied if both of its component specifications are satisfied.
Source code in src/castlecraft_engineer/abstractions/specification.py
NotSpecification
¶
Bases: Specification[T]
A specification that is satisfied if its component specification is not satisfied (logical negation).
Source code in src/castlecraft_engineer/abstractions/specification.py
OrSpecification
¶
Bases: Specification[T]
A composite specification that is satisfied if at least one of its component specifications is satisfied.
Source code in src/castlecraft_engineer/abstractions/specification.py
Specification
¶
Bases: ABC
, Generic[T]
Abstract base class for the Specification pattern. A specification determines if a candidate object matches some criteria.
Source code in src/castlecraft_engineer/abstractions/specification.py
__and__(other)
¶
Combines this specification with another using a logical AND.
Source code in src/castlecraft_engineer/abstractions/specification.py
__invert__()
¶
__or__(other)
¶
Combines this specification with another using a logical OR.
Source code in src/castlecraft_engineer/abstractions/specification.py
is_satisfied_by(candidate)
abstractmethod
¶
Checks if the given candidate object satisfies the specification.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
candidate
|
T
|
The object to check. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the candidate satisfies the specification, False otherwise. |