As you can see in the full printout below, when we call invariant.validates() on an invariant that was defined
by a 2-variable predicate, we get an inscrutable expected description.
This invariant was defined via:
predicate = (lambda args, actual: "PASSE" == actual if args[0] else True)
name = 'DryRunProperty.status'
invariant = Invariant(predicate, name=name)
and spat out the following msg:
<<<<<<<<<<<Invariant for 'DryRunProperty.status' failed for for args (2,): actual is [PASS] BUT expected [<function test_exercises.<locals>.<lambda> at 0x1082557e0>]>>>>>>>>>>>
Full error:
E AssertionError: ===============
E <<<<<<<<<<<Invariant for 'DryRunProperty.status' failed for for args (2,): actual is [PASS] BUT expected [<function test_exercises.<locals>.<lambda> at 0x1082557e0>]>>>>>>>>>>>
E ===============
E App Trace:
E step | PC# | L# | Teal | Scratch | Stack
E --------+-------+------+-------------------+-----------+----------------------
E 1 | 1 | 1 | #pragma version 6 | | []
E 2 | 2 | 2 | arg_0 | | [0x0000000000000002]
E 3 | 3 | 3 | btoi | | [2]
E 4 | 7 | 6 | label1: | | [2]
E 5 | 9 | 7 | store 0 | 0->2 | []
E 6 | 11 | 8 | load 0 | | [2]
E 7 | 13 | 9 | pushint 2 | | [2, 2]
E 8 | 14 | 10 | exp | | [4]
E 9 | 6 | 4 | callsub label1 | | [4]
E 10 | 15 | 11 | retsub | | [4]
E ===============
E MODE: ExecutionMode.Signature
E TOTAL COST: None
E ===============
E FINAL MESSAGE: PASS
E ===============
E Messages: ['PASS']
E Logs: []
E ===============
E -----BlackBoxResult(steps_executed=10)-----
E TOTAL STEPS: 10
E FINAL STACK: [4]
E FINAL STACK TOP: 4
E MAX STACK HEIGHT: 2
E FINAL SCRATCH: {0: 2}
E SLOTS USED: [0]
E FINAL AS ROW: {'steps': 10, ' top_of_stack': 4, 'max_stack_height': 2, 's@000': 2}
E ===============
E Global Delta:
E []
E ===============
E Local Delta:
E []
E ===============
E TXN AS ROW: {' Run': 1, ' cost': None, ' last_log': '`None', ' final_message': 'PASS', ' Status': 'PASS', 'steps': 10, ' top_of_stack': 4, 'max_stack_height': 2, 's@000': 2, 'Arg_00': 2}
E ===============
E <<<<<<<<<<<Invariant for 'DryRunProperty.status' failed for for args (2,): actual is [PASS] BUT expected [<function test_exercises.<locals>.<lambda> at 0x1082557e0>]>>>>>>>>>>>
E ===============
Problem
As you can see in the full printout below, when we call
invariant.validates()
on an invariant that was defined by a 2-variable predicate, we get an inscrutableexpected
description.This invariant was defined via:
and spat out the following
msg
:Full error: