## Importing utilities
from unittests import TestCase #or, in Django:
from django.test import TestCase #(see https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.TestCase)
from unittests impor skip
from mock import (Mock, patch, mock_open, )
from nose.tools import (istest, nottest, assert_equal, raises)
## Writting tests
# xxTest naming for test-autodiscovery
class foobarTest(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_if_i_can_this(self):
self.assertTrue(True)
@skip('why are you skipping a test?')
def test_that(self):
self.assertItemsEqual(actual, [1,2,3,4]) # The sorting doesn't matter
Last active
January 4, 2016 19:39
-
-
Save pfigue/8669157 to your computer and use it in GitHub Desktop.
Python/Django Unit Testing Cheatsheet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment