async def test_held_different_value(freezer, dummy_local_datetime, literal_sixteen): freezer.move_to(dummy_local_datetime) value_expr = MockExpression(15) time_expr = MockExpression(200) expr = timeprocessing.HeldFunction( [value_expr, literal_sixteen, time_expr]) assert await expr.eval() == 0 freezer.move_to(dummy_local_datetime + datetime.timedelta(milliseconds=501)) assert await expr.eval() == 0
async def test_held_fulfilled(freezer, dummy_local_datetime, literal_sixteen): freezer.move_to(dummy_local_datetime) value_expr = MockExpression(16) time_expr = MockExpression(200) expr = timeprocessing.HeldFunction( [value_expr, literal_sixteen, time_expr]) assert await expr.eval(context={}) == 0 time_expr.set_value(500) freezer.move_to(dummy_local_datetime + datetime.timedelta(milliseconds=499)) assert await expr.eval(context={}) == 0 freezer.move_to(dummy_local_datetime + datetime.timedelta(milliseconds=501)) assert await expr.eval(context={}) == 1