Created
February 25, 2010 19:28
-
-
Save batok/314942 to your computer and use it in GitHub Desktop.
Ejemplo de dectools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@post("self.name and self.price >= 0 and Item.tax_rate >= 0", globals()) | |
def __init__(self, name, price): | |
self.name = name | |
self.price = price | |
def _invariant(self): | |
assert self.name not in ("Swiss", "Cheddar") | |
assert self.price > 0 | |
@pre("adjustment < 0") | |
def adjust_price(self, adjustment): | |
self.price += adjustment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment