Hello,
I can’t figure out how works the “complement” primitive.
In this example both tests pass:
class TC_TEST_LIST(TestCase):
def body(self, msg, comp):
if match(msg, complement(*comp)):
setverdict(PASS)
else:
setverdict(FAIL)
TC_TEST_LIST().execute(msg = [ 1, 2, 3 ], comp = [1])
TC_TEST_LIST().execute(msg = [ 1, 2, 3 ], comp = [4])
Am I doing something wrong ?
Thanks for any help,
Mathias
Ho Mathias,
'Complement' is equivalent to 'not included in the provided list'.
So, match(2, complement(1, 2, 3)) is false while match(4, complement(1, 2, 3)) is true (well, if not buggy of course).
Thanks,
-seb
--
You received this message because you are subscribed to the Google Groups "Testerman Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testerman-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Oh yes! I see now
In fact that’s not what I need to do J
Is there a way to match a list if it contains some expected elements (“superset” works perfectly for this) AND if it does NOT contains other elements ?
By example,
match([1, 2, 3], magic_func(toMatch=[1, 2], toUnMatch=[4, 5])) would be true
match([1, 2, 3], magic_func(toMatch=[1, 4], toUnMatch=[5])) would be false
match([1, 2, 3], magic_func(toMatch=[1, 2], toUnMatch=[3])) would be false
Thanks,
Mathias
Hi,
Many thanks Seb, it works perfectly and fits exactly to what I need!
Cheers,
Mathias
PS: It took me a little while to understand the thing with “lambda” and “with_”…
May the force be with you! J