Skip to content

Instantly share code, notes, and snippets.

@gulopine
Created February 15, 2011 04:09
Show Gist options
  • Save gulopine/827082 to your computer and use it in GitHub Desktop.
Save gulopine/827082 to your computer and use it in GitHub Desktop.
Lab Coat: a "scientific" approach to testing
from labcoat import specimen
from animals import Dog, Human
from house import Furniture
from animals.behavior.exceptions import BadDog
def test():
with specimen(Dog) as rover:
rover.has.tail
rover.has(4).legs
rover.can.bark()
rover.s.fur_color == 'brown'
with specimen(Furniture) as couch:
couch.has(4).legs
couch.lacks.tail
couch.can_not.bark()
rover.can.hump(couch)
with specimen(Human) as owner:
owner.has(2).legs
owner.lacks.tail
rover.can_not.hump(owner).because(BadDog)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment