Skip to content

Instantly share code, notes, and snippets.

@batok
Created February 25, 2010 19:28
Show Gist options
  • Save batok/314942 to your computer and use it in GitHub Desktop.
Save batok/314942 to your computer and use it in GitHub Desktop.
Ejemplo de dectools
@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