# Path: nosedjangotests/polls/models.py
# class Poll(models.Model):
#     question = models.CharField(max_length=200)
#     pub_date = models.DateTimeField('date published')
# 
#     @atomic
#     def reset(self):
#         self.question = ""
#         self.save()


from datetime import datetime
from django.db import transaction
from django.test.testcases import TestCase, TransactionTestCase
from nosedjangotests.polls.models import Poll
        Poll.objects.create(
            question='Test',
            pub_date=datetime.now(),
        )
        raise Exception("Oops, that is not a question")


class TestTestCase(TestCase, MakePollMixin):
    def test_make_poll(self):
        with transaction.atomic():
            self.make_poll()
        self.assertEqual(Poll.objects.count(), 1)

    def test_make_poll_and_error(self):
        with self.assertRaisesMessage(Exception, "Oops"):
            with transaction.atomic():
                self.make_poll_and_error()
        self.assertEqual(Poll.objects.count(), 1)


class TestTransactionTestCase(TransactionTestCase, MakePollMixin):
    def test_make_poll(self):
        with transaction.atomic():
            self.make_poll()
        self.assertEqual(Poll.objects.count(), 1)

    def test_make_poll_and_error(self):
        with self.assertRaisesMessage(Exception, "Oops"):
            with transaction.atomic():
                self.make_poll_and_error()

# Path: nosedjangotests/polls/models.py
# class Poll(models.Model):
#     question = models.CharField(max_length=200)
#     pub_date = models.DateTimeField('date published')
# 
#     @atomic
#     def reset(self):
#         self.question = ""
#         self.save()


# Path: nosedjangotests/polls/tests/test_testcases.py
from datetime import datetime
from django.db import transaction
from django.test.testcases import TestCase, TransactionTestCase
from nosedjangotests.polls.models import Poll

        Poll.objects.create(
            question='Test',
            pub_date=datetime.now(),
        )
        raise Exception("Oops, that is not a question")


class TestTestCase(TestCase, MakePollMixin):
    def test_make_poll(self):
        with transaction.atomic():
            self.make_poll()
        self.assertEqual(Poll.objects.count(), 1)

    def test_make_poll_and_error(self):
        with self.assertRaisesMessage(Exception, "Oops"):
            with transaction.atomic():
                self.make_poll_and_error()
        self.assertEqual(Poll.objects.count(), 1)


class TestTransactionTestCase(TransactionTestCase, MakePollMixin):
    def test_make_poll(self):
        with transaction.atomic():
            self.make_poll()
        self.assertEqual(Poll.objects.count(), 1)

    def test_make_poll_and_error(self):
        with self.assertRaisesMessage(Exception, "Oops"):
            with transaction.atomic():
                self.make_poll_and_error()

        self.assertEqual(Poll.objects.count(), 0)