Skip to content

Commit

Permalink
add is_bound prop
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Dec 11, 2023
1 parent 925666d commit 42b2f4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ def bind(
def unbind(self):
self._bound_properties = None

@property
def is_bound(self) -> bool:
return self._bound_properties is not None

@property
def execution_properties(self) -> RunlessExecutionProperties:
return self._execution_properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1390,12 +1390,12 @@ async def main():

def assert_context_unbound(context: RunlessOpExecutionContext):
# to assert that the context is correctly unbound after op invocation
assert context.bound_properties is None
assert not context.is_bound


def assert_context_bound(context: RunlessOpExecutionContext):
# to assert that the context is correctly bound during op invocation
assert context.bound_properties is not None
assert context.is_bound


def assert_execution_properties_cleared(context: RunlessOpExecutionContext):
Expand Down

0 comments on commit 42b2f4a

Please sign in to comment.