-
Notifications
You must be signed in to change notification settings - Fork 1
Docs
Initializes a new spec with a human-readable name. Every spec must begin with a call to it() to describe its intent.
def my_spec():
mp.it("checks something important in the model")
...Retrieves the elements from the Speckle model using a key-value selector. Returns a chainable object for further filtering or assertions.
elements = get("speckle_type", "Base")Filters the elements in a Chainable object, keeping only those where the property selector equals the specified value.
elements = get("speckle_type", "Base").where("name", "Door")Focuses the chain on a specific nested property within the current set of elements. This is typically followed by an assertion using should().
doors = get("type", "IFCDOOR")
doors.its("properties.Dimensions.Area")
...Performs an assertion on the currently selected property using a comparison operator.
doors = get("type", "IFCDOOR")
# Check that the door’s height is greater than 2.10
doors.its("properties.Dimensions.Height").should("be.greater", 2.10)
walls = get("type", "IFCWALL")
# Check that fire rating is set to 'Class 3'
walls.its("properties.Pset_Wall_Common.FireRating").should("have.value", "Class 3")Enumeration of valid comparison operations for use in should():
-
"be.greater": Asserts that the property is greater than the given value. -
"be.smaller": Asserts that the property is smaller than the given value. -
"be.equal": Asserts that the property is exactly equal to the given value. -
"have.value": (string) Asserts that the property matches the given string value. -
"have.length": Asserts that the number of collected items equals the given number.
Executes one or more spec functions. Functions must be passed without invoking them (i.e., without parentheses).
mp.run(spec_1, spec_2, spec_3)