Created
March 2, 2014 18:44
-
-
Save jimmycuadra/9311466 to your computer and use it in GitHub Desktop.
Example test structure
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
class Foo(object): | |
def bar(self): | |
pass | |
def baz(self): | |
pass |
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
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