Skip to content

Instantly share code, notes, and snippets.

@jimmycuadra
Created March 2, 2014 18:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmycuadra/9311466 to your computer and use it in GitHub Desktop.
Save jimmycuadra/9311466 to your computer and use it in GitHub Desktop.
Example test structure
class Foo(object):
def bar(self):
pass
def baz(self):
pass
from pytest import raises
from foo import Foo
class TestBar(object):
def test_returns_a_value_you_expect(self):
assert Foo().bar() == some_value
def test_raises_if_some_condition(self):
do_something_that_sets_up_condition()
with raises(SomeException):
Foo().bar()
class TestBaz(object):
def test_shit_happens_when_you_call_it(self):
Foo().baz()
assert something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment