Trellis tests for inconsistent init and missed circularity (no fixes yet)
Sergey Schetinin <[email protected]> Sat, 4 Apr 2009 15:45:22 +0300
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
I'm sending two more tests to add to the test suite in disabled state as there are no fixes available ATM. http://www.eby-sarna.com/pipermail/peak/2008-November/003151.html -- Best Regards, Sergey Schetinin http://s3bk.com/ -- S3 Backup http://word-to-html.com/ -- Word to HTML Converter _______________________________________________ PEAK mailing list [email protected] http://www.eby-sarna.com/mailman/listinfo/peak
tests-future.py
(application/octet-stream, 678 B)
from peak.events import trellis
class TestOrder(trellis.Component):
trellis.compute.attrs(
rule_a = lambda self: [self.rule_b, 'a'],
rule_b = lambda self: [self.rule_a, 'b']
)
TestOrder().rule_a # [[None, 'b'], 'a']
# should throw CircularityError
class TestInsonsistentInit(trellis.Component):
trellis.attrs(v1=False, v2=True)
@trellis.maintain(optional=True)
def rule_a(self):
self.v2 = False
@trellis.maintain
def rule_b(self):
if self.v1 and self.v2:
self.rule_a
return True
tc = TestInsonsistentInit()
tc.v1 = True
#print tc.v2, tc.rule_b # False, True
assert not tc.v2
assert not tc.rule_b